summaryrefslogtreecommitdiff
path: root/Porting
diff options
context:
space:
mode:
authorLeon Brocard <acme@astray.com>2011-06-10 10:34:41 +0100
committerLeon Brocard <acme@astray.com>2011-06-10 10:34:41 +0100
commitee682a851e75ef16ba37952dd6a8f29c835ef554 (patch)
tree210c3fdc6b13e927af73e8fa4be28f970a50516d /Porting
parentfad4a2e4a4e2d22bf0b29de7f20808f0a01e79a2 (diff)
downloadperl-ee682a851e75ef16ba37952dd6a8f29c835ef554.tar.gz
Update Porting/core-cpan-diff to use HTTP::Tiny
Diffstat (limited to 'Porting')
-rw-r--r--Porting/core-cpan-diff21
1 files changed, 7 insertions, 14 deletions
diff --git a/Porting/core-cpan-diff b/Porting/core-cpan-diff
index 56e7f840b6..67e9cb0cb4 100644
--- a/Porting/core-cpan-diff
+++ b/Porting/core-cpan-diff
@@ -20,6 +20,7 @@ use IO::Uncompress::Gunzip ();
use File::Compare ();
use ExtUtils::Manifest;
use ExtUtils::MakeMaker ();
+use HTTP::Tiny;
BEGIN { die "Must be run from root of perl source tree\n" unless -d 'Porting' }
use lib 'Porting';
@@ -562,26 +563,18 @@ sub cpan_to_perl {
return $perl_file;
}
-# do LWP::Simple::getstore, possibly without LWP::Simple being available
-
-my $lwp_simple_available;
+# fetch a file from a URL and store it in a file given by a filename
sub my_getstore {
my ( $url, $file ) = @_;
File::Path::mkpath( File::Basename::dirname($file) );
- unless ( defined $lwp_simple_available ) {
- eval { require LWP::Simple };
- $lwp_simple_available = $@ eq '';
- }
- if ($lwp_simple_available) {
- return LWP::Simple::is_success( LWP::Simple::getstore( $url, $file ) );
- }
- elsif ( $url =~ qr{\Afile://(?:localhost)?/} ) {
+ if ( $url =~ qr{\Afile://(?:localhost)?/} ) {
( my $local_path = $url ) =~ s{\Afile://(?:localhost)?}{};
File::Copy::copy( $local_path, $file );
- }
- else {
- return system( WGET_CMD, "-O", $file, $url ) == 0;
+ } else {
+ my $http = HTTP::Tiny->new;
+ my $response = $http->mirror($url, $file);
+ return $response->{success};
}
}