summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbigail <abigail@abigail.be>2012-03-14 01:59:48 +0100
committerAbigail <abigail@abigail.be>2012-03-14 02:40:06 +0100
commit5b73aae5f11067a2f45e856ae2113f569949cf8f (patch)
tree9c7ee3eecc27098b8b7c676ec646f8a08817dbf4
parent233d887d0c6b144420b64ec4ba0b3b4838c76490 (diff)
downloadperl-5b73aae5f11067a2f45e856ae2113f569949cf8f.tar.gz
Allow passing the name of the CPAN module
-rwxr-xr-xPorting/sync-with-cpan13
1 files changed, 7 insertions, 6 deletions
diff --git a/Porting/sync-with-cpan b/Porting/sync-with-cpan
index 3c9c732f95..1c078f2e78 100755
--- a/Porting/sync-with-cpan
+++ b/Porting/sync-with-cpan
@@ -72,9 +72,10 @@ unless (-f $package_file && -M $package_file < 1) {
system wget => $package_url, '-qO', $package_file;
}
-die "Usage: $0 module" unless @ARGV == 1;
+die "Usage: $0 module [cpan package]" unless @ARGV == 1 || @ARGV == 2;
-my ($module) = @ARGV;
+my ($module) = shift;
+my $cpan_mod = @ARGV ? shift : $module;
my $info = $Modules {$module} or die "Cannot find module $module";
my $distribution = $$info {DISTRIBUTION};
@@ -84,15 +85,15 @@ my $pkg_dir = $$info {FILES};
my ($old_version) = $distribution =~ /-([0-9.]+)\.tar\.gz/;
my $o_module = $module;
-if ($module =~ /-/ && $module !~ /::/) {
- $module =~ s/-/::/g;
+if ($cpan_mod =~ /-/ && $cpan_mod !~ /::/) {
+ $cpan_mod =~ s/-/::/g;
}
#
# Find the information from CPAN.
#
-my $new_line = `grep '^$module ' $package_file`
- or die "Cannot find $module on CPAN\n";
+my $new_line = `grep '^$cpan_mod ' $package_file`
+ or die "Cannot find $cpan_mod on CPAN\n";
chomp $new_line;
my (undef, $new_version, $new_path) = split ' ', $new_line;
my $new_file = (split '/', $new_path) [-1];