1CPAN::FindDependencies(U3s)er Contributed Perl DocumentatCiPoAnN::FindDependencies(3)
2
3
4
6 CPAN::FindDependencies - find dependencies for modules on the CPAN
7
9 use CPAN::FindDependencies;
10 my @dependencies = CPAN::FindDependencies::finddeps("CPAN");
11 foreach my $dep (@dependencies) {
12 print ' ' x $dep->depth();
13 print $dep->name().' ('.$dep->distribution().")\n";
14 }
15
17 Up to version 2.49 you used the "02packages" argument to specify where
18 a cached "02packages.details.txt.gz" could be found. That argument no
19 longer exists as of version 3.00, use the "mirror" argument instead.
20
21 Up to version 2.49, "maxdepth => 0" would incorrectly return the whole
22 tree. From version 3.00 it cuts the tree off at its root so will only
23 return the module that you asked about. Not very useful, but correct.
24
25 In version 2.49 you used the "configreqs" argument to specify that you
26 were interested in configure-time requirements as well as build- and
27 run-time requirements. That option no longer exists as of version 3.00,
28 it will always report on configure, build, test, and run-time
29 requirements.
30
32 The module uses the CPAN packages index to map modules to distributions
33 and vice versa, and then fetches distributions' metadata or Makefile.PL
34 files from a CPAN mirror to determine pre-requisites. This means that
35 a working interwebnet connection is required.
36
38 There is just one function, which is not exported by default although
39 you can make that happen in the usual fashion.
40
41 finddeps
42 Takes a single compulsory parameter, the name of a module (ie
43 Some::Module); and the following optional named parameters:
44
45 nowarnings
46 Warnings about modules where we can't find their META.yml or
47 Makefile.PL, and so can't divine their pre-requisites, will be
48 suppressed;
49
50 fatalerrors
51 Failure to get a module's dependencies will be a fatal error
52 instead of merely emitting a warning;
53
54 perl
55 Use this version of perl to figure out what's in core. If not
56 specified, it defaults to 5.005. Three part version numbers (eg
57 5.8.8) are supported but discouraged.
58
59 cachedir
60 A directory to use for caching. It defaults to no caching. Even
61 if caching is turned on, this is only for META.yml or Makefile.PL
62 files.
63
64 The cache is never automatically cleared out. It is your
65 responsibility to clear out old data.
66
67 maxdepth
68 Cuts off the dependency tree at the specified depth. Your
69 specified module is at depth 0, your dependencies at depth 1, their
70 dependencies at depth 2, and so on.
71
72 If you don't specify any maxdepth at all it will grovel over the
73 entire tree.
74
75 mirror
76 This can be provided more than once, if for example you want to use
77 a private Pinto repository for your own code while using a public
78 CPAN mirror for open source dependencies. The argument comes in two
79 parts separated by a comma - the base URL from which to fetch
80 files, and optionally the URL or a file from which to fetch the
81 index "02packages.details.txt.gz" file to use with that mirror.
82
83 mirror https://cpan.mydomain.net,file:///home/me/mycache/02packages.txt.gz
84
85 If you want to use the default CPAN mirror
86 (https://cpan.metacpan.org/) but also specify an index location you
87 can use "DEFAULT" for the mirror URL.
88
89 So for example, to use your own special private mirror, including
90 fetching 02packages from it, but also use the default mirror with a
91 cached local copy of its 02packages, specify two mirrors thus:
92
93 mirror => 'https://cpan.mydomain.net',
94 mirror => 'DEFAULT,file:///home/me/mycache/02packages.txt.gz'
95
96 The index is cached for three minutes or until your process
97 finishes, whichever is soonest. This is because it is HUMUNGOUS and
98 parsing it takes ages even when it's loaded from a local disk, and
99 I don't want the tests to take forever.
100
101 usemakefilepl
102 If set to true, then for any module that doesn't have a META.yml,
103 try to use its Makefile.PL as well. Note that this involves
104 downloading code from the Internet and running it. This obviously
105 opens you up to all kinds of bad juju, hence why it is disabled by
106 default. NB that this fetches Makefile.PL from
107 <https://fastapi.metacpan.org> only so will not work for private
108 mirrors. This is a deliberate choice, your own private code ought
109 to be packaged properly with a META file, you should only care
110 about divining dependencies from Makefile.PL if you rely on really
111 old stuff on public CPAN mirrors.
112
113 recommended
114 Adds recommended modules to the list of dependencies, if set to a
115 true value.
116
117 suggested
118 Adds suggested modules to the list of dependencies, if set to a
119 true value.
120
121 It returns a list of CPAN::FindDependencies::Dependency objects, whose
122 useful methods are:
123
124 name
125 The module's name;
126
127 distribution
128 The distribution containing this module;
129
130 version
131 The minimum required version of his module (if specified in the
132 requirer's pre-requisites list);
133
134 depth
135 How deep in the dependency tree this module is;
136
137 warning
138 If any warning was generated (even if suppressed) for the module,
139 it will be recorded here.
140
141 Any modules listed as dependencies but which are in the perl core
142 distribution for the version of perl you specified are suppressed.
143
144 These objects are returned in a semi-defined order. You can be sure
145 that a module will be immediately followed by one of its dependencies,
146 then that dependency's dependencies, and so on, followed by the 'root'
147 module's next dependency, and so on. You can reconstruct the tree by
148 paying attention to the depth of each object.
149
150 The ordering of any particular module's immediate 'children' can be
151 assumed to be random - it's actually hash key order.
152
154 The dependency tree is pruned to remove duplicates. This means that
155 even though "Test::More", for example, is a dependency of almost
156 everything on the CPAN, it will only be listed once.
157
159 If you set "usemakefilepl" to a true value, this module may download
160 code from the internet and execute it. You should think carefully
161 before enabling that feature.
162
164 You must have web access to <http://metacpan.org/> and (unless you tell
165 it where else to look for the index) <http://www.cpan.org/>, or have
166 all the data cached locally.. If any metadata or Makefile.PL files are
167 missing, the distribution's dependencies will not be found and a
168 warning will be spat out.
169
170 Startup can be slow, especially if it needs to fetch the index from the
171 interweb.
172
173 Dynamic dependencies - for example, dependencies that only apply on
174 some platforms - can't be reliably resolved. They *may* be resolved if
175 you use the unsafe Makefile.PL, but even that can't be relied on.
176
178 I welcome feedback about my code, including constructive criticism and
179 bug reports. The best bug reports include files that I can add to the
180 test suite, which fail with the current code in my git repo and will
181 pass once I've fixed the bug
182
183 Feature requests are far more likely to get implemented if you submit a
184 patch yourself.
185
187 <git://github.com/DrHyde/perl-modules-CPAN-FindDependencies.git>
188
190 CPAN
191
192 <http://deps.cpantesters.org/>
193
194 <http://metacpan.org>
195
197 Copyright 2007 - 2019 David Cantrell <david@cantrell.org.uk>
198
199 This software is free-as-in-speech software, and may be used,
200 distributed, and modified under the terms of either the GNU General
201 Public Licence version 2 or the Artistic Licence. It's up to you which
202 one you use. The full text of the licences can be found in the files
203 GPL2.txt and ARTISTIC.txt, respectively.
204
206 Stephan Loyd (for fixing problems with some META.yml files)
207
208 Alexandr Ciornii (for a patch to stop it segfaulting on Windows)
209
210 Brian Phillips (for the code to report on required versions of modules)
211
212 Ian Tegebo (for the code to extract deps from Makefile.PL)
213
214 Georg Oechsler (for the code to also list 'recommended' modules)
215
216 Jonathan Stowe (for making it work through HTTP proxies)
217
218 Kenneth Olwing (for support for 'configure_requires')
219
221 This module is also free-as-in-mason software.
222
223
224
225perl v5.34.0 2021-08-12 CPAN::FindDependencies(3)