This file is indexed.

/usr/bin/modules-used is in libmodule-used-perl 1.3.0-2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
#!/usr/bin/env perl

use utf8;
use 5.008003;

use strict;
use warnings;

use version; our $VERSION = qv('v1.3.0');

use Const::Fast qw< const >;
use English qw< -no_match_vars >;

use File::Next ();

use Module::Used qw< modules_used_in_files >;

const my %IGNORED_DIRECTORIES =>
    map { $_ => 1 }
    qw<
        .bzr
        .cdv
        ~.dep
        ~.dot
        ~.nib
        ~.plst
        .git
        .hg
        .pc
        .svn
        blib
        CVS
        RCS
        SCCS
        _darcs
        _sgbak
        autom4te.cache
        cover_db
        _build
    >;

return 1 if caller;
exit run(@ARGV);

sub run {
    my (@argv) = @_;

    my @modules = modules_used_in_files( _get_files(@argv) );
    foreach my $module ( sort { lc $a cmp lc $b } @modules ) {
        print "$module\n";
    } # end foreach

    return 0;
} # end run()


sub _get_files {
    my @paths = @_;

    my $iterator = File::Next::files(
        {
            file_filter => sub {
                    not _is_ignored_file($_)
                and _is_perl_file($File::Next::name)
            },
            descend_filter => sub { not _is_ignored_directory($_) },
        },
        @paths,
    );

    my @files;
    while ( defined ( my $file = $iterator->() ) ) {
        push @files, $file;
    }

    return @files;
}

sub _is_ignored_directory {
    my ($directory) = @_;

    return 1 if exists $IGNORED_DIRECTORIES{$directory};
    return 0;
}

sub _is_ignored_file {
    my ($file) = @_;

    return 1 if $file =~ qr< (?: [.] bak | ~ ) \z >xms;
    return 1 if $file =~ qr< [#] .+ [#] \z        >xms;
    return 1 if $file =~ qr< [._] .* [.]sw[op] \z >xms;
    return $file =~ qr< core [.] \d+ \z           >xms;
}

sub _is_perl_file {
    my ($file) = @_;

    return 1 if $file =~ m/ [.] (?: p (?: l x? | m ) | t | PL ) \z /xms;
    return 0 if index($file, q<.>) >= 0;
    return _is_perl_program($file);
}

sub _is_perl_program {
    my ($file) = @_;

    if (open my $handle, '<', $file) {
        my $first_line = <$handle>;

        if (not close $handle) {
            die qq<Could not close "$file": $OS_ERROR\n>;
        }

        return $first_line =~ m< \A [#]! .* \bperl >xms;
    }

    die qq<Could not open "$file": $OS_ERROR\n>;
}

__END__

=encoding utf8

=for stopwords

=head1 NAME

modules-used - List modules used by a set of Perl source files without running them.


=head1 VERSION

This document describes modules-used version 1.3.0.


=head1 USAGE

    modules-used source-file [...]


=head1 DESCRIPTION

Dumps a list of modules used by some Perl code.  Modules are found statically
based upon C<use> and C<require> statements.  If use of the L<base> or
L<parent> is found, both that module and the referenced ones will be emitted.

Dynamically loaded modules will not be found.


=head1 REQUIRED ARGUMENTS

=over

=item · source-file [...]

A list of files to search.


=back


=head1 OPTIONS

None.


=head1 DIAGNOSTICS

=over

=item Could not find module "%s" in @INC.

Cannot find the location of the named module.  Note that this program will not
find any dynamically loaded modules.


=item "%s" does not exist.

Cannot find the file.


=item "%s" is not readable.

Cannot read the file.


=item "%s" is a directory.

The "file" was actually a directory.


=item Could not parse "%s".

L<PPI> could not interpret the file as a Perl document.


=back


=head1 CONFIGURATION AND ENVIRONMENT

None.


=head1 DEPENDENCIES

L<Module::Used>


=head1 INCOMPATIBILITIES

None known.


=head1 BUGS AND LIMITATIONS

None reported.

Please report any bugs or feature requests to C<bug-module-used@rt.cpan.org>,
or through the web interface at L<http://rt.cpan.org>.


=head1 SEE ALSO

L<Devel::Loaded>
L<Module::Extract::Namespaces>
L<Module::ScanDeps>
L<Module::PrintUsed>


=head1 AUTHOR

Elliot Shank C<< <perl@galumph.com> >>


=head1 LICENSE AND COPYRIGHT

Copyright ©2008-2012, Elliot Shank C<< <perl@galumph.com> >>.

This module is free software; you can redistribute it and/or modify it
under the same terms as Perl itself. See L<perlartistic>.


=head1 DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT
WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER
PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE LIABLE
TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.

=cut

# setup vim: set filetype=perl tabstop=4 softtabstop=4 expandtab :
# setup vim: set shiftwidth=4 shiftround textwidth=78 nowrap autoindent :
# setup vim: set foldmethod=indent foldlevel=0 :