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 If you set "usemakefilepl" to a true value, this module may download
155 code from the internet and execute it. You should think carefully
156 before enabling that feature.
157
159 You must have web access to <http://metacpan.org/> and (unless you tell
160 it where else to look for the index) <http://www.cpan.org/>, or have
161 all the data cached locally.. If any metadata or Makefile.PL files are
162 missing, the distribution's dependencies will not be found and a
163 warning will be spat out.
164
165 Startup can be slow, especially if it needs to fetch the index from the
166 interweb.
167
168 Dynamic dependencies - for example, dependencies that only apply on
169 some platforms - can't be reliably resolved. They *may* be resolved if
170 you use the unsafe Makefile.PL, but even that can't be relied on.
171
173 I welcome feedback about my code, including constructive criticism and
174 bug reports. The best bug reports include files that I can add to the
175 test suite, which fail with the current code in my git repo and will
176 pass once I've fixed the bug
177
178 Feature requests are far more likely to get implemented if you submit a
179 patch yourself.
180
182 <git://github.com/DrHyde/perl-modules-CPAN-FindDependencies.git>
183
185 CPAN
186
187 <http://deps.cpantesters.org/>
188
189 <http://metacpan.org>
190
192 Copyright 2007 - 2019 David Cantrell <david@cantrell.org.uk>
193
194 This software is free-as-in-speech software, and may be used,
195 distributed, and modified under the terms of either the GNU General
196 Public Licence version 2 or the Artistic Licence. It's up to you which
197 one you use. The full text of the licences can be found in the files
198 GPL2.txt and ARTISTIC.txt, respectively.
199
201 Stephan Loyd (for fixing problems with some META.yml files)
202
203 Alexandr Ciornii (for a patch to stop it segfaulting on Windows)
204
205 Brian Phillips (for the code to report on required versions of modules)
206
207 Ian Tegebo (for the code to extract deps from Makefile.PL)
208
209 Georg Oechsler (for the code to also list 'recommended' modules)
210
211 Jonathan Stowe (for making it work through HTTP proxies)
212
213 Kenneth Olwing (for support for 'configure_requires')
214
216 This module is also free-as-in-mason software.
217
218
219
220perl v5.32.1 2021-02-25 CPAN::FindDependencies(3)