aboutsummaryrefslogtreecommitdiffstats
path: root/perl.req
diff options
context:
space:
mode:
authorMichael Scherer <misc@mandriva.com>2005-09-28 19:18:52 +0000
committerMichael Scherer <misc@mandriva.com>2005-09-28 19:18:52 +0000
commit7f860a772a8ecbd83dee8934ff0765dd14ea0c4c (patch)
treedce0d0d0f8a7b5933fb20559929238f0a85c47fd /perl.req
parent3e57b072370a85eb15c104f0096a4acd2bec1d94 (diff)
downloadrpm-setup-7f860a772a8ecbd83dee8934ff0765dd14ea0c4c.tar
rpm-setup-7f860a772a8ecbd83dee8934ff0765dd14ea0c4c.tar.gz
rpm-setup-7f860a772a8ecbd83dee8934ff0765dd14ea0c4c.tar.bz2
rpm-setup-7f860a772a8ecbd83dee8934ff0765dd14ea0c4c.tar.xz
rpm-setup-7f860a772a8ecbd83dee8934ff0765dd14ea0c4c.zip
add the proper detection of 'use base qw(Foo::Bar)' construct
Diffstat (limited to 'perl.req')
-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;
+ }
}
}