1Test::Dependencies(3) User Contributed Perl DocumentationTest::Dependencies(3)
2
3
4
6 Test::Dependencies - Ensure that the dependency listing is complete
7
9 Version 0.32
10
12 In your t/00-dependencies.t:
13
14 use CPAN::Meta; # or CPAN::Meta::cpanfile
15 use File::Find::Rule::Perl;
16
17 use Test::More;
18 use Test::Dependencies '0.28' forward_compatible => 1;
19
20 my $meta = CPAN::Meta->load_file('META.json'); # or META.yml
21 plan skip_all => 'No META.json' if ! $meta;
22
23 my @files = File::Find::Rule::Perl->perl_files->in('./lib', './bin');
24 ok_dependencies($meta, \@files, [qw/runtime configure build test/],
25 undef, # all features in the cpanfile
26 ignores => [ qw/ Your::Namespace Some::Other::Namespace / ]
27 );
28
29 done_testing;
30
32 Makes sure that all of the modules that are 'use'd are listed in the
33 Makefile.PL as dependencies.
34
36 DEPRECATED You can pass options to the module via the 'use' line.
37 These options will be moved to the ok_dependencies() function. The
38 available options are:
39
40 forward_compatible
41 When specified and true, stops the module from outputting a plan,
42 which is the default mode of operation when the module becomes 1.0.
43
44 exclude
45 Specifies the list of namespaces for which it is ok not to have
46 specified dependencies.
47
48 style
49 DEPRECATED
50
51 There used to be the option of specifying a style; the heavy style
52 depended on B::PerlReq. This module stopped working somewhere
53 around Perl 5.20. Specifying a style no longer has any effect.
54
56 ok_dependencies($meta, $files, $phases, $features, %options)
57 $meta is a CPAN::Meta object
58 $files is an arrayref with files to be scanned
59
60 %options keys
61
62 phases
63 This is an arrayref holding one or more names of phases as defined
64 by CPAN::Meta::Spec, or undef for all
65
66 features
67 This is an arrayref holding zero or more names of features, or
68 undef for all
69
70 ignores
71 This is a arrayref listing the names of modules (and their sub-
72 namespaces) for which no errors are to be reported.
73
74 ok_dependencies()
75 Deprecated. Legacy invocation to be removed. In previous versions, this
76 function would scan the entire bin/, lib/ and t/ subtrees, with the
77 exception of a few sub-directories known to be used by version control
78 systems.
79
80 This behaviour has been changed: as of 0.20, Find::File::Rule::Perl is
81 being used to find Perl files (*.pl, *.pm, *.t and those starting with
82 a shebang line referring to perl).
83
85 • Jesse Vincent "<jesse at bestpractical.com>"
86
87 • Alex Vandiver "<alexmv at bestpractical.com>"
88
89 • Zev Benjamin "<zev at cpan.org>"
90
91 • Erik Huelsmann "<ehuels at gmail.com>"
92
94 • Test::Dependencies does not track module version requirements.
95
96 Please report your bugs on GitHub:
97
98 L<https://github.com/ehuelsmann/perl-Test-Dependencies/issues>
99
101 You can find documentation for this module with the perldoc command.
102
103 perldoc Test::Dependencies
104
105 You can also look for information at:
106
107 • CPAN Ratings
108
109 <http://cpanratings.perl.org/d/Test-Dependencies>
110
111 • Search CPAN
112
113 <http://search.cpan.org/dist/Test-Dependencies>
114
116 Copyright (c) 2016-2023, Erik Huelsmann. All rights reserved.
117 Copyright (c) 2007, Best Practical Solutions, LLC. All rights reserved.
118
119 This module is free software; you can redistribute it and/or modify it
120 under the same terms as Perl itself. See perlartistic.
121
122 DISCLAIMER OF WARRANTY
123
124 BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
125 FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
126 OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
127 PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
128 EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
129 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
130 ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
131 YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
132 NECESSARY SERVICING, REPAIR, OR CORRECTION.
133
134 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
135 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
136 REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE
137 TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
138 CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
139 SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
140 RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
141 FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
142 SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
143 DAMAGES.
144
145
146
147perl v5.38.0 2023-07-21 Test::Dependencies(3)