From: David Mitchell Date: Wed, 24 Jun 2009 12:03:12 +0000 (+0100) Subject: core-cpan-diff: continue with next distro on download failure X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8c814d1a540c5a07adc0648dc9d2b879bab3d772;p=p5sagit%2Fp5-mst-13.2.git core-cpan-diff: continue with next distro on download failure --- diff --git a/Porting/core-cpan-diff b/Porting/core-cpan-diff index 80d6b7d..b4a5c35 100755 --- a/Porting/core-cpan-diff +++ b/Porting/core-cpan-diff @@ -141,11 +141,11 @@ sub run { my $outfh; if (defined $output_file) { open $outfh, '>', $output_file - or die "ERROR: could not open file '$output_file' for writing: $!"; + or die "ERROR: could not open file '$output_file' for writing: $!\n"; } else { open $outfh, ">&STDOUT" - or die "ERROR: can't dup STDOUT: $!"; + or die "ERROR: can't dup STDOUT: $!\n"; } if (defined $cache_dir) { @@ -208,8 +208,15 @@ sub do_compare { } $seen_dist{$dist}++; - my $cpan_dir = get_distribution($cache_dir, $untar_dir, $module, $dist); - + my $cpan_dir; + eval { + $cpan_dir = get_distribution($cache_dir, $untar_dir, $module, $dist) + }; + if ($@) { + print $outfh " ", $@; + print $outfh " (skipping)\n"; + next; + } my @perl_files = Maintainers::get_module_files($module); @@ -520,7 +527,7 @@ sub get_distribution { my ($cache_dir, $untar_dir, $module, $dist) = @_; $dist =~ m{.+/([^/]+)$} - or die "ERROR: $module: invalid DISTRIBUTION name (no AUTHOR/ prefix): $dist"; + or die "ERROR: $module: invalid DISTRIBUTION name (no AUTHOR/ prefix): $dist\n"; my $filename = $1; my $download_dir = $cache_dir || File::Temp::tempdir( CLEANUP => 1 ); @@ -536,18 +543,18 @@ sub get_distribution { unless (-f $download_file) { # not cached $dist =~ /^([A-Z])([A-Z])/ - or die "ERROR: $module: invalid DISTRIBUTION name (not /^[A-Z]{2}/): $dist"; + or die "ERROR: $module: invalid DISTRIBUTION name (not /^[A-Z]{2}/): $dist\n"; my $url = "http://www.cpan.org/modules/by-authors/id/$1/$1$2/$dist"; my_getstore($url, $download_file) - or die "ERROR: Could not fetch '$url'"; + or die "ERROR: Could not fetch '$url'\n"; } # extract distribution my $ae = Archive::Extract->new( archive => $download_file); $ae->extract( to => $untar_dir ) - or die "ERROR: failed to extract distribution '$download_file to temp. dir: " . $ae->error(); + or die "ERROR: failed to extract distribution '$download_file to temp. dir: " . $ae->error() . "\n"; # get the name of the extracted distribution dir