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. Other warnings may still be emitted though, such as
49 those telling you about modules which have dodgy (but still
50 understandable) metadata;
51
52 fatalerrors
53 Failure to get a module's dependencies will be a fatal error
54 instead of merely emitting a warning;
55
56 perl
57 Use this version of perl to figure out what's in core. If not
58 specified, it defaults to 5.005. Three part version numbers (eg
59 5.8.8) are supported but discouraged.
60
61 cachedir
62 A directory to use for caching. It defaults to no caching. Even
63 if caching is turned on, this is only for META.yml or Makefile.PL
64 files.
65
66 The cache is never automatically cleared out. It is your
67 responsibility to clear out old data.
68
69 maxdepth
70 Cuts off the dependency tree at the specified depth. Your
71 specified module is at depth 0, your dependencies at depth 1, their
72 dependencies at depth 2, and so on.
73
74 If you don't specify any maxdepth at all it will grovel over the
75 entire tree.
76
77 mirror
78 This can be provided more than once, if for example you want to use
79 a private Pinto repository for your own code while using a public
80 CPAN mirror for open source dependencies. The argument comes in two
81 parts separated by a comma - the base URL from which to fetch
82 files, and optionally the URL or a file from which to fetch the
83 index "02packages.details.txt.gz" file to use with that mirror.
84
85 mirror https://cpan.mydomain.net,file:///home/me/mycache/02packages.txt.gz
86
87 If you want to use the default CPAN mirror
88 (https://cpan.metacpan.org/) but also specify an index location you
89 can use "DEFAULT" for the mirror URL.
90
91 So for example, to use your own special private mirror, including
92 fetching 02packages from it, but also use the default mirror with a
93 cached local copy of its 02packages, specify two mirrors thus:
94
95 mirror => 'https://cpan.mydomain.net',
96 mirror => 'DEFAULT,file:///home/me/mycache/02packages.txt.gz'
97
98 The index is cached for three minutes or until your process
99 finishes, whichever is soonest. This is because it is HUMUNGOUS and
100 parsing it takes ages even when it's loaded from a local disk, and
101 I don't want the tests to take forever.
102
103 usemakefilepl
104 If set to true, then for any module that doesn't have a META.yml,
105 try to use its Makefile.PL as well. Note that this involves
106 downloading code from the Internet and running it. This obviously
107 opens you up to all kinds of bad juju, hence why it is disabled by
108 default. NB that this fetches Makefile.PL from
109 <https://fastapi.metacpan.org> only so will not work for private
110 mirrors. This is a deliberate choice, your own private code ought
111 to be packaged properly with a META file, you should only care
112 about divining dependencies from Makefile.PL if you rely on really
113 old stuff on public CPAN mirrors.
114
115 recommended
116 Adds recommended modules to the list of dependencies, if set to a
117 true value.
118
119 suggested
120 Adds suggested modules to the list of dependencies, if set to a
121 true value.
122
123 Order of arguments is not important.
124
125 It returns a list of CPAN::FindDependencies::Dependency objects, whose
126 useful methods are:
127
128 name
129 The module's name;
130
131 distribution
132 The distribution containing this module;
133
134 version
135 The minimum required version of his module (if specified in the
136 requirer's pre-requisites list);
137
138 depth
139 How deep in the dependency tree this module is;
140
141 warning
142 If any warning was generated (even if suppressed) for the module,
143 it will be recorded here.
144
145 Any modules listed as dependencies but which are in the perl core
146 distribution for the version of perl you specified are suppressed.
147
148 These objects are returned in a semi-defined order. You can be sure
149 that a module will be immediately followed by one of its dependencies,
150 then that dependency's dependencies, and so on, followed by the 'root'
151 module's next dependency, and so on. You can reconstruct the tree by
152 paying attention to the depth of each object.
153
154 The ordering of any particular module's immediate 'children' can be
155 assumed to be random - it's actually hash key order.
156
158 The dependency tree is pruned to remove duplicates. This means that
159 even though "Test::More", for example, is a dependency of almost
160 everything on the CPAN, it will only be listed once.
161
163 If you set "usemakefilepl" to a true value, this module may download
164 code from the internet and execute it. You should think carefully
165 before enabling that feature.
166
168 You must have web access to <http://metacpan.org/> and (unless you tell
169 it where else to look for the index) <http://www.cpan.org/>, or have
170 all the data cached locally.. If any metadata or Makefile.PL files are
171 missing, the distribution's dependencies will not be found and a
172 warning will be spat out.
173
174 Startup can be slow, especially if it needs to fetch the index from the
175 interweb.
176
177 Dynamic dependencies - for example, dependencies that only apply on
178 some platforms - can't be reliably resolved. They *may* be resolved if
179 you use the unsafe Makefile.PL, but even that can't be relied on.
180
182 I welcome feedback about my code, including constructive criticism and
183 bug reports. The best bug reports include files that I can add to the
184 test suite, which fail with the current code in my git repo and will
185 pass once I've fixed the bug
186
187 Feature requests are far more likely to get implemented if you submit a
188 patch yourself.
189
191 <git://github.com/DrHyde/perl-modules-CPAN-FindDependencies.git>
192
194 CPAN
195
196 <http://deps.cpantesters.org/>
197
198 <http://metacpan.org>
199
201 Copyright 2007 - 2019 David Cantrell <david@cantrell.org.uk>
202
203 This software is free-as-in-speech software, and may be used,
204 distributed, and modified under the terms of either the GNU General
205 Public Licence version 2 or the Artistic Licence. It's up to you which
206 one you use. The full text of the licences can be found in the files
207 GPL2.txt and ARTISTIC.txt, respectively.
208
210 Stephan Loyd (for fixing problems with some META.yml files)
211
212 Alexandr Ciornii (for a patch to stop it segfaulting on Windows)
213
214 Brian Phillips (for the code to report on required versions of modules)
215
216 Ian Tegebo (for the code to extract deps from Makefile.PL)
217
218 Georg Oechsler (for the code to also list 'recommended' modules)
219
220 Jonathan Stowe (for making it work through HTTP proxies)
221
222 Kenneth Olwing (for support for 'configure_requires')
223
225 This module is also free-as-in-mason software.
226
227
228
229perl v5.34.1 2022-04-19 CPAN::FindDependencies(3)