summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2015-05-01 12:20:09 +0200
committerDaniel Friesel <derf@finalrewind.org>2015-05-01 12:20:09 +0200
commit399495687d24f122a710f4de8abf14eca6912fe3 (patch)
tree2922c94633c08eecbb124ed2926f6616ff0ce740
parent5927366ddb8989b1e329329e82834124c7fff1d5 (diff)
IRIS: use lwp_options in constructor
-rw-r--r--Changelog6
-rw-r--r--lib/Travel/Status/DE/IRIS.pm11
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<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.