aboutsummaryrefslogtreecommitdiff
path: root/SBO-Lib/lib/SBO/Lib.pm
diff options
context:
space:
mode:
authorAndreas Guldstrand <andreas.guldstrand@gmail.com>2016-05-03 00:06:15 +0200
committerAndreas Guldstrand <andreas.guldstrand@gmail.com>2016-05-03 00:06:15 +0200
commite7940430151bbe31ca3e6563b7dd27a54429fa97 (patch)
treeae5fe847e1ed31109a534dcb74aecc7e012bdecb /SBO-Lib/lib/SBO/Lib.pm
parentd29cb5065ffef0450ffe052597cd135880813ac9 (diff)
downloadsbotools2-e7940430151bbe31ca3e6563b7dd27a54429fa97.tar.xz
SBO::Lib:: rewrite get_installed_cpans()
Diffstat (limited to 'SBO-Lib/lib/SBO/Lib.pm')
-rw-r--r--SBO-Lib/lib/SBO/Lib.pm14
1 files changed, 2 insertions, 12 deletions
diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm
index efc1ff0..d7801cb 100644
--- a/SBO-Lib/lib/SBO/Lib.pm
+++ b/SBO-Lib/lib/SBO/Lib.pm
@@ -1264,29 +1264,19 @@ sub get_readme_contents {
# return a list of perl modules installed via the CPAN
sub get_installed_cpans {
- my @locals;
- for my $dir (@INC) {
- push @locals, "$dir/perllocal.pod" if -f "$dir/perllocal.pod";
- }
my @contents;
- for my $file (@locals) {
+ for my $file (grep { -f $_ } map { "$_/perllocal.pod" } @INC) {
my ($fh, $exit) = open_read($file);
- return [] if $exit;
-# push @contents, grep {/Module|VERSION/} <$fh>;
+ next if $exit;
push @contents, grep {/Module/} <$fh>;
close $fh;
}
my $mod_regex = qr/C<Module>\s+L<([^\|]+)/;
-# my $ver_regex = qr/C<VERSION:\s+([^>]+)>/;
my (@mods, @vers);
for my $line (@contents) {
push @mods, ($line =~ $mod_regex)[0];
-# push @vers, ($line =~ $ver_regex)[0];
}
return \@mods;
-# my %cpans;
-# $cpans{$mods[$_]} = $vers[$_] for keys @mods;
-# return \%cpans;
}
# look for any (user|group)add commands in the README