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