diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2007-10-10 15:36:53 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2007-10-10 15:36:53 +0000 |
commit | 5bc5f6dcbaef1be54e82568ecec8132658cc613e (patch) | |
tree | 8794fd2fd18be62a07b01dec3d55a06fd894cf7b /lib/CPANPLUS/Internals/Report.pm | |
parent | 401667e9af6ec282136e4e49614eb18614c5654b (diff) | |
download | perl-5bc5f6dcbaef1be54e82568ecec8132658cc613e.tar.gz |
Update CPANPLUS to 0.83_02
p4raw-id: //depot/perl@32092
Diffstat (limited to 'lib/CPANPLUS/Internals/Report.pm')
-rw-r--r-- | lib/CPANPLUS/Internals/Report.pm | 55 |
1 files changed, 35 insertions, 20 deletions
diff --git a/lib/CPANPLUS/Internals/Report.pm b/lib/CPANPLUS/Internals/Report.pm index ffcb4f0d33..cbe20a6cf0 100644 --- a/lib/CPANPLUS/Internals/Report.pm +++ b/lib/CPANPLUS/Internals/Report.pm @@ -9,8 +9,8 @@ use CPANPLUS::Internals::Constants::Report; use Data::Dumper; use Params::Check qw[check]; -use Locale::Maketext::Simple Class => 'CPANPLUS', Style => 'gettext'; use Module::Load::Conditional qw[can_load]; +use Locale::Maketext::Simple Class => 'CPANPLUS', Style => 'gettext'; $Params::Check::VERBOSE = 1; @@ -53,16 +53,14 @@ otherwise. =cut { my $query_list = { - LWP => '0.0', - 'LWP::UserAgent' => '0.0', - 'HTTP::Request' => '0.0', - URI => '0.0', - YAML => '0.0', + 'File::Fetch' => '0.08', + 'YAML::Tiny' => '0.0', + 'File::Temp' => '0.0', }; my $send_list = { %$query_list, - 'Test::Reporter' => 1.27, + 'Test::Reporter' => '1.34', }; sub _have_query_report_modules { @@ -158,27 +156,41 @@ sub _query_report { ### check if we have the modules we need for querying return unless $self->_have_query_report_modules( verbose => 1 ); - ### new user agent ### - my $ua = LWP::UserAgent->new; - $ua->agent( CPANPLUS_UA->() ); + ### XXX no longer use LWP here. However, that means we don't + ### automagically set proxies anymore!!! + # my $ua = LWP::UserAgent->new; + # $ua->agent( CPANPLUS_UA->() ); + # ### set proxies if we have them ### - $ua->env_proxy(); + # $ua->env_proxy(); my $url = TESTERS_URL->($mod->package_name); - my $req = HTTP::Request->new( GET => $url); + my $ff = File::Fetch->new( uri => $url ); msg( loc("Fetching: '%1'", $url), $verbose ); - my $res = $ua->request( $req ); + my $res = do { + my $tempdir = File::Temp::tempdir(); + my $where = $ff->fetch( to => $tempdir ); + + unless( $where ) { + error( loc( "Fetching report for '%1' failed: %2", + $url, $ff->error ) ); + return; + } - unless( $res->is_success ) { - error( loc( "Fetching report for '%1' failed: %2", - $url, $res->message ) ); - return; - } + my $fh = OPEN_FILE->( $where ); + + do { local $/; <$fh> }; + }; + + my ($aref) = eval { YAML::Tiny::Load( $res ) }; - my $aref = YAML::Load( $res->content ); + if( $@ ) { + error(loc("Error reading result: %1", $@)); + return; + }; my $dist = $mod->package_name .'-'. $mod->package_version; @@ -439,7 +451,7 @@ sub _send_report { $message .= REPORT_LOADED_PREREQS->($mod); ### the footer - $message .= REPORT_MESSAGE_FOOTER->(); + $message .= REPORT_MESSAGE_FOOTER->(); ### it may be another grade than fail/unknown.. may be worth noting ### that tests got skipped, since the buffer is not added in @@ -479,12 +491,15 @@ sub _send_report { } } } + + msg( loc("Sending test report for '%1'", $dist), $verbose); ### reporter object ### my $reporter = Test::Reporter->new( grade => $grade, distribution => $dist, via => "CPANPLUS $int_ver", + timeout => $conf->get_conf('timeout') || 60, debug => $conf->get_conf('debug'), ); |