From b87bfaf33d1f55cd756031fd4f3a9ecf4419f7ea Mon Sep 17 00:00:00 2001 From: Leon Brocard Date: Mon, 18 Jul 2011 11:56:18 +0100 Subject: [PATCH] Move Porting/corelist.pl from LWP::Simple/curl/wget to HTTP::Tiny --- Porting/corelist.pl | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Porting/corelist.pl b/Porting/corelist.pl index 4e18e37..f524d3e 100755 --- a/Porting/corelist.pl +++ b/Porting/corelist.pl @@ -18,6 +18,7 @@ use Maintainers qw(%Modules files_to_modules); use File::Spec; use Parse::CPAN::Meta; use IPC::Cmd 'can_run'; +use HTTP::Tiny; my $corelist_file = 'dist/Module-CoreList/lib/Module/CoreList.pm'; @@ -261,12 +262,12 @@ sub write_corelist { sub fetch_url { my $url = shift; - eval { require LWP::Simple }; - if ( LWP::Simple->can('get') ) { - return LWP::Simple::get($url); - } elsif (`which curl`) { - return `curl -s $url`; - } elsif (`which wget`) { - return `wget -q -O - $url`; + my $http = HTTP::Tiny->new; + my $response = $http->get($url); + if ($response->{success}) { + return $response->{content}; + } else { + warn "Error fetching $url: $response->{status} $response->{reason}\n"; + return; } } -- 2.7.4