pmwhich 513 B

123456789101112131415161718192021222324252627282930
  1. #!/usr/bin/env perl
  2. # find a Perl module's path on the filesystem
  3. # <https://github.com/brennen/bpb-kit/blob/master/bin/pmwhich>
  4. use warnings;
  5. use strict;
  6. use 5.10.0;
  7. my $to_use;
  8. if (defined $ARGV[0]) {
  9. $to_use = $ARGV[0];
  10. } else {
  11. die "Must specify a module to check path for.";
  12. }
  13. eval("use $to_use");
  14. my $filename = $to_use;
  15. $filename =~ s{ :: }{/}gx;
  16. $filename .= '.pm';
  17. if ($INC{$filename}) {
  18. say $INC{$filename};
  19. } else {
  20. say "$to_use not found";
  21. }
  22. # say $_ . " => " . $INC{$_} for keys %INC;