Skip Menu |

This queue is for tickets about the WWW-Mechanize-Timed CPAN distribution.

Report information
The Basics
Id: 57748
Status: new
Priority: 0/
Queue: WWW-Mechanize-Timed

People
Owner: Nobody in particular
Requestors: book [...] cpan.org
Cc: book [...] cpan.org
AdminCc:

Bug Information
Severity: Important
Broken in: 0.44
Fixed in: (no value)



CC: book [...] cpan.org
Subject: Warnings are fatal, and one method issues warnings in a relatively common case
Hi, When an error prevents the actual HTTP request to be sent (this happens when requesting a non-existent domain, or when there is not route to reach that host), the client_total_time() method dies with "Use of uninitialized value in addition (+)". Example: $ perl -MWWW::Mechanize::Timed -le '$m=WWW::Mechanize::Timed->new( );$m->get(shift);print $m->client_total_time; print "done"' http://bad.example.com/ Use of uninitialized value in addition (+) at /opt/perl/5.10.0/lib/site_perl/5.10.0/WWW/Mechanize/Timed.pm line 52. Note how "done" is *not* printed, because the script dies. This is because of: * use warnings FATAL => 'all'; * the fact that all of client_request_connect_time, client_request_transmit_time, client_response_server_time and client_response_receive_time are undefined if the request is not sent Possible fixes: * remove the FATAL => 'all' parameter to warnings * provide defaults of 0 to the four times in client_total_time()'s code In my code, I use eval { $mech->client_total_time } || 0 as an ugly workaround. Thanks, -- BooK