From e633a0039c4cbe55d670984c2870189b95d161c2 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 1 May 2015 19:49:27 +0200 Subject: URA->new: Use lwp_options to pass parameters to LWP::UA constructor --- lib/Travel/Status/DE/URA.pm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'lib/Travel/Status/DE/URA.pm') diff --git a/lib/Travel/Status/DE/URA.pm b/lib/Travel/Status/DE/URA.pm index 19ab7a7..ab02936 100644 --- a/lib/Travel/Status/DE/URA.pm +++ b/lib/Travel/Status/DE/URA.pm @@ -19,7 +19,9 @@ use Travel::Status::DE::URA::Result; sub new { my ( $class, %opt ) = @_; - my $ua = LWP::UserAgent->new(%opt); + my %lwp_options = %{ $opt{lwp_options} // { timeout => 10 } }; + + my $ua = LWP::UserAgent->new(%lwp_options); my $response; if ( not( $opt{ura_base} and $opt{ura_version} ) ) { @@ -284,6 +286,17 @@ The request URL is I/instant_VI, so for C<< http://ivu.aseag.de/interfaces/ura >>, C<< 1 >> this module will point requests to C<< http://ivu.aseag.de/interfaces/ura/instant_V1 >>. +The following parameter is optional: + +=over + +=item B => I<\%hashref> + +Passed on to C<< LWP::UserAgent->new >>. Defaults to C<< { timeout => 10 } >>, +you can use an empty hashref to override it. + +=back + Additionally, all options supported by C<< $status->results >> may be specified here, causing them to be used as defaults. Note that while they may be overridden later, they may limit the set of available departures requested from -- cgit v1.2.3