1Module::Used(3) User Contributed Perl Documentation Module::Used(3)
2
3
4
6 Module::Used - Find modules loaded by Perl code without running it.
7
9 This document describes Module::Used version 1.3.0.
10
12 use Module::Used qw< :all >;
13
14 @modules = modules_used_in_files(@files);
15 @modules = modules_used_in_modules(@module_names);
16
17 # "strict", "Find::Bin", "warnings"
18 @modules = modules_used_in_string(
19 'use strict; require Find::Bin; no warnings;'
20 );
21
22 # "Exporter"
23 @modules = modules_used_in_string( 'use parent 0.221 qw< Exporter >;' );
24
26 Modules are found statically based upon "use" and "require" statements.
27 If use of the base or parent is found, both that module and the
28 referenced ones will be returned. If Moose or Moose::Role are found,
29 this will look for "extends" and "with" sugar will be looked for;
30 presently, this will miss modules listed in parentheses.
31
32 Dynamically loaded modules will not be found.
33
35 Nothing is exported by default, but you can import everything using the
36 ":all" tag.
37
38 " modules_used_in_files( @files ) "
39 Return a list of modules used in the specified files.
40
41 "die"s if there is a problem reading a file.
42
43 " modules_used_in_modules( @module_names ) "
44 Return a list of modules used in the specified modules.
45
46 "die"s if there any of the modules weren't found in @INC.
47
48 " modules_used_in_string( $string ) "
49 Return a list of modules used in the code in the parameter.
50
51 " modules_used_in_document( $document ) "
52 Return a list of modules used in the specified PPI::Document.
53
55 Could not find module "%s" in @INC.
56 Cannot find the location of the named module. Note that this
57 module will not find any dynamically loaded modules.
58
59 "%s" does not exist.
60 Cannot find the file.
61
62 "%s" is not readable.
63 Cannot read the file.
64
65 "%s" is a directory.
66 The "file" was actually a directory.
67
68 Could not parse "%s".
69 PPI could not interpret the file as a Perl document.
70
72 None, currently.
73
75 Const::Fast Module::Path PPI::Document version
76
78 None reported.
79
81 None reported.
82
83 Please report any bugs or feature requests to
84 "bug-module-used@rt.cpan.org", or through the web interface at
85 <http://rt.cpan.org>.
86
88 Devel::Loaded Module::Extract::Namespaces Module::ScanDeps
89 Module::PrintUsed
90
92 Elliot Shank "<perl@galumph.com>"
93
95 Copyright X2008-2012, Elliot Shank "<perl@galumph.com>".
96
97 This module is free software; you can redistribute it and/or modify it
98 under the same terms as Perl itself. See perlartistic.
99
101 BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
102 FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT
103 WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER
104 PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND,
105 EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
106 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
107 ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
108 YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
109 NECESSARY SERVICING, REPAIR, OR CORRECTION.
110
111 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
112 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
113 REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE LIABLE
114 TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
115 CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
116 SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
117 RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
118 FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
119 SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
120 DAMAGES.
121
122
123
124perl v5.34.0 2021-07-22 Module::Used(3)