/usr/bin/mpath is in libmodule-path-perl 0.15-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 | #!/usr/bin/env perl
use strict;
use warnings;
use 5.006;
use Module::Path qw(module_path);
use Getopt::Long qw(GetOptions);
use Pod::Usage qw(pod2usage);
GetOptions(\my %opts, 'help|h|?', 'quiet|q', 'full|f')
or pod2usage 2;
if ($opts{help}) {
pod2usage(
-verbose => 2,
-exitval => 0,
)
}
elsif (!@ARGV) {
pod2usage(
-message => 'No module specified',
-verbose => 1,
);
}
my $all_found = 1;
for my $module (@ARGV) {
my $path = module_path($module);
if (!defined($path)) {
$all_found = 0;
print "$module not found\n" unless $opts{quiet};
}
else {
print "$module " if $opts{full};
print "$path\n";
}
}
my $status = $all_found ? 0 : 1;
exit $status;
=head1 NAME
mpath - display the full path to a perl module (installed locally)
=head1 USAGE
mpath [OPTIONS] MODULE [MODULE ...]
=head1 EXAMPLE
% mpath Module::Path
/usr/local/lib/perl5/site_perl/5.16.0/Module/Path.pm
% mpath --full Module::Path
Module::Path /usr/local/lib/perl5/site_perl/5.16.0/Module/Path.pm
% mpath Moose Moo
/usr/local/lib/perl5/site_perl/5.16.0/darwin-2level/Moose.pm
/usr/local/lib/perl5/site_perl/5.16.0/Moo.pm
=head1 DESCRIPTION
mpath displays the full path to a perl module on the local system.
It uses the C<module_path()> function from L<Module::Path> to get the path.
If one of the module wasn't found, mpath will exit with the exit code 1 and
print the following message (you can silence it with the option B<--quiet>):
% mpath Foo::Bar
Foo::Bar not found
or:
% mpath Moose Foo::Bar
/usr/local/lib/perl5/site_perl/5.16.0/darwin-2level/Moose.pm
Foo::Bar not found
=head1 OPTIONS
=over
=item B<-h>, B<-?>, B<--help>
Print this help message and exit.
=item B<-f>, B<--full>
Print module name.
=item B<-q>, B<--quiet>
Don't print any error when one of the module requested could not be found.
=back
=head1 SEE ALSO
L<Module::Path>
=head1 AUTHOR
Neil Bowers E<lt>neilb@cpan.orgE<gt>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Neil Bowers E<lt>neilb@cpan.orgE<gt>.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
|