Skip to content

Instantly share code, notes, and snippets.

@trapd00r
Created April 16, 2011 19:16
Show Gist options
  • Save trapd00r/923400 to your computer and use it in GitHub Desktop.
Save trapd00r/923400 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use strict;
use warnings FATAL => 'all';
my $module = 'IO::File';
my @modules = @ARGV;
if(!@modules) {
@modules = qw(
IO::File
Term::ANSIColor
Test::More
Tie::File
Term::ReadLine
)
}
for my $module(@modules) {
eval "require $module";
printf("%20.20s found in %s\n", $module, $INC{ module_to_path($module) } );
}
# Translate IO::File to IO/File.pm so we can look it up in the %INC hash.
sub module_to_path {
my $m = shift;
my $f = $m;
$f =~ s{::}{/}g;
return "$f.pm";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment