diff options
author | Daniel Friesel <derf@finalrewind.org> | 2015-05-01 19:49:27 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2015-05-01 19:49:27 +0200 |
commit | e633a0039c4cbe55d670984c2870189b95d161c2 (patch) | |
tree | 92b8673f75e31a46645533ca3b0a0d1b2e00d115 /lib/Travel | |
parent | a18276e764bf4c451cb7087ff7e27429571797e8 (diff) |
URA->new: Use lwp_options to pass parameters to LWP::UA constructor
Diffstat (limited to 'lib/Travel')
-rw-r--r-- | lib/Travel/Status/DE/URA.pm | 15 |
1 files changed, 14 insertions, 1 deletions
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<ura_base>/instant_VI<version>, 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<lwp_options> => 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 |