diff options
author | Daniel Friesel <derf@finalrewind.org> | 2015-05-01 12:20:09 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2015-05-01 12:20:09 +0200 |
commit | 399495687d24f122a710f4de8abf14eca6912fe3 (patch) | |
tree | 2922c94633c08eecbb124ed2926f6616ff0ce740 /lib/Travel/Status/DE | |
parent | 5927366ddb8989b1e329329e82834124c7fff1d5 (diff) |
IRIS: use lwp_options in constructor
Diffstat (limited to 'lib/Travel/Status/DE')
-rw-r--r-- | lib/Travel/Status/DE/IRIS.pm | 11 |
1 files changed, 8 insertions, 3 deletions
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<lwp_options> => I<\%hashref> + +Passed on to C<< LWP::UserAgent->new >>. Defaults to C<< { timeout => 10 } >>, +use an empty hashref to override. + =item B<station> => I<stationcode> 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. |