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 --- Changelog | 6 ++++++ lib/Travel/Status/DE/IRIS.pm | 11 ++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Changelog b/Changelog index 35254a0..e4c7f40 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,9 @@ +git HEAD + + * IRIS->new: Use lwp_options to explicitly pass arguments to the + LWP::UserAgent constructor. Unknown arguments are now longer + implicitly passed on + Travel::Status::DE::IRIS 0.10 - Tue Apr 30 2015 * Result: Fix deep recursion error in TO_JSON 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