aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xperl.req30
1 files changed, 27 insertions, 3 deletions
diff --git a/perl.req b/perl.req
index 400d49e..007b501 100755
--- a/perl.req
+++ b/perl.req
@@ -138,7 +138,8 @@ sub process_file {
/x)
) {
my ($whitespace, $statement, $module, $version) = ($1, $2, $3,$4);
-
+ my $usebase;
+
# we only consider require statements that are flush against
# the left edge. any other require statements give too many
# false positives, as they are usually inside of an if statement
@@ -174,6 +175,17 @@ sub process_file {
next;
}
+ # as seen in some perl script
+ # use base qw(App::CLI Class::Accessor::Chained::Fast App::CLI::Command);
+ if ($module eq 'base') {
+ $require{$module}=$version;
+ $line{$module}=$current_line;
+
+ ($module = $_) =~ s/use\s*base\S*//;
+ $module =~ s/qw\((.*)\);/$1/;
+ $usebase = 1;
+
+ }
# sometimes people do use POSIX qw(foo), or use POSIX(qw(foo)) etc
# we can strip qw.*$, as well as (.*$:
$module =~ s/qw.*$//;
@@ -221,8 +233,20 @@ sub process_file {
($module =~ m/\.ph$/) && next;
- $require{$module}=$version;
- $line{$module}=$_;
+ # if the module was loaded trough base, we need to split the list
+ if ($usebase)
+ {
+ my $current_line=$_;
+ foreach(split(/\s+/,$module))
+ {
+ next unless $_;
+ $require{$_}=$version;
+ $line{$_}=$current_line;
+ }
+ } else {
+ $require{$module}=$version;
+ $line{$module}=$current_line;
+ }
}
}