This file is indexed.

/usr/bin/module_info is in libmodule-info-perl 0.35-1.

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
#!/usr/bin/perl -w

eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}'
    if 0; # not running under some shell

=head1 NAME

module_info - find information about modules

=head1 SYNOPSIS

  module_info [B<-a>] [B<-s>] [B<-p>] [B<-m>] MODULE|FILE...

=head1 DESCRIPTION

List information about the arguments (either module names in the form
C<Module::Name> or paths in the form C<Foo/Bar.pm> or C<foo/bar.pl>).

By default only shows module name, version, directory, absolute path
and a flag indicating if it is a core module. Additional information
can be requested through command line switches.

=over 4

=item B<-s>

Show subroutines created by the module.

=item B<-p>

Show packages created by the module.

=item B<-m>

Show modules C<use()>d by the module.

=item B<-a>

Equivalent to C<-s -p -m>.

=back

=head1 AUTHOR

Mattia Barbon <mbarbon@cpan.org>

=head1 SEE ALSO

L<Module::Info>

=cut

use strict;
use Module::Info;
use Getopt::Long;

my( $show_subroutines, $show_modules, $show_packages, $show_all, $help );

GetOptions( 's' => \$show_subroutines,
            'p' => \$show_packages,
            'm' => \$show_modules,
            'a' => \$show_all,
            'h' => \$help,
          );

if( $help || !@ARGV ) {
    print <<EOT;
Usage: module_info [-a] [-s] [-p] [-m] MODULE|FILE...

    -a Equivalent to -s -p -m
    -h Help message
    -m Show modules use()d by the module
    -p Show packages created by the module
    -s Show subroutines created by the module
EOT
    exit 0;
}

$show_subroutines ||= $show_all;
$show_modules ||= $show_all;
$show_packages ||= $show_all;

my $some_error = 0;

foreach my $module (@ARGV) {
    my $info;

    if( -f $module ) {
        $info = Module::Info->new_from_file($module);
    }
    else {
        $info = Module::Info->new_from_module($module);
    }

    unless( $info ) {
        warn "Can't create Module::Info object for module '$module'";
        $some_error = 1;
        next;
    }

    $info->die_on_compilation_error(1);

    my $name = $info->name || $module;
    my $version = $info->version || '(unknown)';
    my $dir = $info->inc_dir;
    my $file = $info->file;
    my $is_core = $info->is_core ? "yes" : "no";

    print <<EOT;

Name:        $name
Version:     $version
Directory:   $dir
File:        $file
Core module: $is_core
EOT

    my %packages_created;
    my @modules_used;
    my %subroutines;

    eval {
        @modules_used = $info->modules_used if $show_modules;
        %packages_created = $info->package_versions if $show_packages;
        %subroutines = $info->subroutines if $show_subroutines;
    };
    if( $@ ) {
        warn "Compilation failed for module '$module'";
        $some_error = 1;
        next;
    }

    ###########################################################################
    # Modules used
    ###########################################################################
    if( $show_modules ) {
        print "\nModules used:\n";
        foreach my $m (sort @modules_used) {
            print "    $m\n";
        }
        print "    (none)\n" unless @modules_used;
    }

    ###########################################################################
    # Packages defined
    ###########################################################################
    if( $show_packages ) {
        print "\nPackages created:\n";
        foreach my $p (sort keys %packages_created) {
            print "    $p\t";
            print +( defined( $packages_created{$p} ) ?
                                $packages_created{$p} :
                                      '(no version)' );
            print "\n";
        }
        print "    (none)\n" unless keys %packages_created;
    }

    ###########################################################################
    # Subroutines
    ###########################################################################
    if( $show_subroutines ) {
        print "\nSubroutines defined:\n";
        {
            my @subroutines =
              sort  { ( $a->[0] cmp $b->[0] ) || ( $a->[1] cmp $b->[1] ) }
              map   {
                        my($package, $subname) = ($_ =~ m/^(.*)?::(\w+)$/);
                        warn "Strange subroutine '$_'"
                          unless $package || $subname;
                        $package ||= '(unknown)';
                        $subname ||= '(unknown)';
                        [ $package, $subname ];
                    } keys %subroutines;
            my $prev_package = ':'; # impossible
            foreach my $s (@subroutines) {
                my($package, $subname) = @$s;
                if($prev_package ne $package) {
                    $prev_package = $package;
                    print "    $package\n";
                }

                print "        $subname\n";
            }
        }
        print "    (none)\n" unless %subroutines;
    }
}

exit $some_error;