Skip to content

Instantly share code, notes, and snippets.

@charlesthomas
Last active August 29, 2015 13:57
Show Gist options
  • Save charlesthomas/9694897 to your computer and use it in GitHub Desktop.
Save charlesthomas/9694897 to your computer and use it in GitHub Desktop.
Check for the existence of a Perl module
#!/usr/bin/perl
use strict;
eval "use $ARGV[0]";
my $path=$ARGV[0];
$path =~ s/::/\//g;
$path.='.pm';
my $location=$INC{$path};
print $location ? $location : "$ARGV[0] not installed";
print "\n";
exit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment