From 399495687d24f122a710f4de8abf14eca6912fe3 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 1 May 2015 12:20:09 +0200 Subject: IRIS: use lwp_options in constructor --- lib/Travel/Status/DE/IRIS.pm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/Travel/Status/DE/IRIS.pm b/lib/Travel/Status/DE/IRIS.pm index 89a7c02..4a4d3f4 100644 --- a/lib/Travel/Status/DE/IRIS.pm +++ b/lib/Travel/Status/DE/IRIS.pm @@ -19,7 +19,9 @@ use XML::LibXML; sub new { my ( $class, %opt ) = @_; - my $ua = LWP::UserAgent->new(%opt); + my %lwp_options = %{ $opt{lwp_options} // { timeout => 10 } }; + + my $ua = LWP::UserAgent->new( %{ $opt{lwp_options} } ); if ( not $opt{station} ) { confess('station flag must be passed'); @@ -448,6 +450,11 @@ have no effect. However, as the IRIS occasionally contains unscheduled departures or qos messages known far in advance (e.g. 12 hours from now), any non-negative integer is accepted. +=item B => I<\%hashref> + +Passed on to C<< LWP::UserAgent->new >>. Defaults to C<< { timeout => 10 } >>, +use an empty hashref to override. + =item B => I Mandatory: Which station to return departures for. Note that this is not a @@ -457,8 +464,6 @@ name to code mapping. =back -All other options are passed to the LWP::UserAgent(3pm) constructor. - =item $status->errstr In case of a fatal HTTP request or IRIS error, returns a string describing it. -- cgit v1.2.3