From 702002d7d9dae38e7ae375dafefa20ae0f865a16 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 30 Apr 2015 13:37:22 +0200 Subject: EFA, efa-m: Add timeout parameter --- lib/Travel/Status/DE/EFA.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib') diff --git a/lib/Travel/Status/DE/EFA.pm b/lib/Travel/Status/DE/EFA.pm index f8ea9f7..248f017 100644 --- a/lib/Travel/Status/DE/EFA.pm +++ b/lib/Travel/Status/DE/EFA.pm @@ -18,6 +18,11 @@ use XML::LibXML; sub new { my ( $class, %opt ) = @_; + $opt{timeout} //= 10; + if ( $opt{timeout} <= 0 ) { + delete $opt{timeout}; + } + my $ua = LWP::UserAgent->new(%opt); my @now = localtime( time() ); @@ -473,6 +478,11 @@ B (stop/station name). address / poi / stop name to list departures for. +=item B => I + +Request timeout, the argument is passed on to LWP::UserAgent(3pm). +Default: 10 seconds. Set to 0 or a negative value to disable it. + =back =item $status->errstr -- cgit v1.2.3