From 7bdbf7c77480d17d4a0dbfbc5272c2f54639a662 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 1 May 2015 20:33:00 +0200 Subject: ->new: add lwp_options parameter --- Changelog | 5 +++++ lib/Travel/Status/DE/DeutscheBahn.pm | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Changelog b/Changelog index 01e1b84..20ae7d0 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,8 @@ +git HEAD + + * DeutscheBahn->new: Add lwp_options parameter to pass options to + LWP::UserAgent->new + Travel::Status::DE::DeutscheBahn 1.03 - Tue Oct 21 2014 * Add primitive JSON serializer to Travel::Status::DE::DeutscheBahn::Result diff --git a/lib/Travel/Status/DE/DeutscheBahn.pm b/lib/Travel/Status/DE/DeutscheBahn.pm index b8918e6..0a40b3b 100644 --- a/lib/Travel/Status/DE/DeutscheBahn.pm +++ b/lib/Travel/Status/DE/DeutscheBahn.pm @@ -19,7 +19,9 @@ sub new { my $date = strftime( '%d.%m.%Y', localtime(time) ); my $time = strftime( '%H:%M', localtime(time) ); - my $ua = LWP::UserAgent->new(); + my %lwp_options = %{ $conf{lwp_options} // { timeout => 10 } }; + + my $ua = LWP::UserAgent->new(%lwp_options); $ua->env_proxy; @@ -326,6 +328,11 @@ Date to report for. Defaults to the current day. Set language for additional information. Accepted arguments: Beutsch, Bnglish, Btalian, B (dutch). +=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. + =item B