Skip to content

Instantly share code, notes, and snippets.

@hellojukay
Created June 2, 2021 10:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hellojukay/4f2b5a329f6249d507a521ee7e903fe3 to your computer and use it in GitHub Desktop.
Save hellojukay/4f2b5a329f6249d507a521ee7e903fe3 to your computer and use it in GitHub Desktop.
perl list installed modules
#!/usr/bin/env perl
sub find_modules {
my $dir = shift;
my @modules = ();
if(-d $dir){
chdir $dir;
my @files = glob "**/*.pm";
foreach (@files) {
$_ =~ s/$\.pm//g;
$_ =~ s/\//\:\:/g;
printf "%s\n",$_;
}
}
return @modules;
}
foreach (@INC){
find_modules($_);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment