summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-05-19 16:39:50 +0100
committerNicholas Clark <nick@ccl4.org>2011-05-23 15:07:27 +0100
commit3a06b4ede32aae6fcf73a24516301c7d959a3b82 (patch)
treeb328f4c665bb04647ae68c23819b67f170e3aab2
parent144a708b2275ee00fb979c6abd3e4bd0e3982401 (diff)
downloadperl-3a06b4ede32aae6fcf73a24516301c7d959a3b82.tar.gz
Only load Maintainers.pm if cmpVERSION.pl is invoked with -x
Skip chdir $source_dir with -x, because -x checks that it's '.'
-rwxr-xr-xPorting/cmpVERSION.pl15
1 files changed, 7 insertions, 8 deletions
diff --git a/Porting/cmpVERSION.pl b/Porting/cmpVERSION.pl
index dd3d20c462..81384f271d 100755
--- a/Porting/cmpVERSION.pl
+++ b/Porting/cmpVERSION.pl
@@ -20,9 +20,6 @@ use File::Find;
use File::Spec::Functions qw(rel2abs abs2rel catfile catdir curdir);
use Getopt::Std;
-use lib 'Porting';
-use Maintainers;
-
sub usage {
die <<"EOF";
usage: $0 [ -d -x ] source_dir tag_to_compare
@@ -51,16 +48,18 @@ my %dual_files;
if ($opts{x}) {
die "With -x, the directory must be '.'\n"
unless $source_dir eq '.';
- for my $m (grep $Maintainers::Modules{$_}{CPAN},
- keys %Maintainers::Modules)
- {
+ unshift @INC, 'Porting';
+ require Maintainers;
+
+ for my $m (grep $Maintainers::Modules{$_}{CPAN},
+ keys %Maintainers::Modules) {
$dual_files{$_} = 1 for Maintainers::get_module_files($m);
}
+} else {
+ chdir $source_dir or die "$0: chdir '$source_dir' failed: $!\n";
}
-chdir $source_dir or die "$0: chdir '$source_dir' failed: $!\n";
-
# Files to skip from the check for one reason or another,
# usually because they pull in their version from some other file.
my %skip;