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.24
10
12 In your t/00-dependencies.t:
13
14 use CPAN::Meta; # or CPAN::Meta::cpanfile
15 use File::Find::Rule::Perl;
16 use Test::Dependencies exclude =>
17 [qw/ Your::Namespace Some::Other::Namespace /];
18
19 my $meta = CPAN::Meta->load_file('META.yml');
20 die "No META.yml" if ! $meta;
21
22 my @files =
23 File::Find::Rule::Perl->perl_files->in('./lib', './bin');
24
25 ok_dependencies($meta, \@files);
26
28 Makes sure that all of the modules that are 'use'd are listed in the
29 Makefile.PL as dependencies.
30
32 DEPRECATED You can pass options to the module via the 'use' line.
33 These options will be moved to the ok_dependencies() function. The
34 available options are:
35
36 exclude
37 Specifies the list of namespaces for which it is ok not to have
38 specified dependencies.
39
40 style
41 DEPRECATED
42
43 There used to be the option of specifying a style; the heavy style
44 depended on B::PerlReq. This module stopped working somewhere
45 around Perl 5.20. Specifying a style no longer has any effect.
46
47 Old text:
48
49 Specifies the style of module usage checking to use. There are two
50 valid values: "light" and "heavy". The default is heavy. The
51 light style uses regular expressions to try and guess which modules
52 are required. It is fast, but can get confused by here-docs,
53 multi-line strings, data sections, etc. The heavy style actually
54 compiles the file and asks perl which modules were used. It is
55 slower than the light style, but much more accurate. If you have a
56 very large project and you don't want to wait for the heavy style
57 every time you run "make test," you might want to try the light
58 style or look into the overrides below.
59
60 Whether a style is specified or not, the style used can be
61 overridden by the environment variable TDSTYLE. This is useful,
62 for example, if you want the heavy style to be used normally, but
63 don't want to take the time checking dependencies on your smoke
64 test server.
65
66 Example usage:
67
68 use Test::Dependencies
69 exclude => ['Test::Dependencies'],
70 style => 'light';
71
73 ok_dependencies($meta, $files, $phases, $features, %options)
74 $meta is a CPAN::Meta object
75 $files is an arrayref with files to be scanned
76
77 %options keys
78
79 phases
80 This is an arrayref holding one or more names of phases as defined
81 by CPAN::Meta::Spec, or undef for all
82
83 features
84 This is an arrayref holding zero or more names of features, or
85 undef for all
86
87 ignores
88 This is a hashref listing the names of modules (and their sub-
89 namespaces) for which no errors are to be reported.
90
91 ok_dependencies()
92 Deprecated. Legacy invocation to be removed. In previous versions, this
93 function would scan the entire bin/, lib/ and t/ subtrees, with the
94 exception of a few sub-directories known to be used by version control
95 systems.
96
97 This behaviour has been changed: as of 0.20, Find::File::Rule::Perl is
98 being used to find Perl files (*.pl, *.pm, *.t and those starting with
99 a shebang line referring to perl).
100
102 · Jesse Vincent "<jesse at bestpractical.com>"
103
104 · Alex Vandiver "<alexmv at bestpractical.com>"
105
106 · Zev Benjamin "<zev at cpan.org>"
107
108 · Erik Huelsmann "<ehuels at gmail.com>"
109
111 · Test::Dependencies does not track module version requirements.
112
113 Please report your bugs on GitHub:
114
115 L<https://github.com/ehuelsmann/perl-Test-Dependencies/issues>
116
118 You can find documentation for this module with the perldoc command.
119
120 perldoc Test::Dependencies
121
122 You can also look for information at:
123
124 · CPAN Ratings
125
126 <http://cpanratings.perl.org/d/Test-Dependencies>
127
128 · Search CPAN
129
130 <http://search.cpan.org/dist/Test-Dependencies>
131
133 Copyright (c) 2016-2019, Erik Huelsmann. All rights reserved.
134 Copyright (c) 2007, Best Practical Solutions, LLC. All rights reserved.
135
136 This module is free software; you can redistribute it and/or modify it
137 under the same terms as Perl itself. See perlartistic.
138
139 DISCLAIMER OF WARRANTY
140
141 BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
142 FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
143 OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
144 PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
145 EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
146 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
147 ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
148 YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
149 NECESSARY SERVICING, REPAIR, OR CORRECTION.
150
151 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
152 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
153 REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE
154 TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
155 CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
156 SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
157 RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
158 FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
159 SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
160 DAMAGES.
161
162
163
164perl v5.30.1 2020-01-30 Test::Dependencies(3)