From: Leon Brocard Date: Mon, 18 Jul 2011 10:56:18 +0000 (+0100) Subject: Move Porting/corelist.pl from LWP::Simple/curl/wget to HTTP::Tiny X-Git-Tag: accepted/trunk/20130322.191538~3268 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b87bfaf33d1f55cd756031fd4f3a9ecf4419f7ea;p=platform%2Fupstream%2Fperl.git Move Porting/corelist.pl from LWP::Simple/curl/wget to HTTP::Tiny --- 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; } }