diff options
author | Daniel Friesel <derf@finalrewind.org> | 2015-09-17 17:51:45 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2015-09-17 17:51:45 +0200 |
commit | 12888c2cfe2494f51df8d661e692c292e6f26b61 (patch) | |
tree | 2da2509125af2efb5110afd771e74945783e1e02 /lib/Travel/Status/DE/HAFAS/StopFinder.pm | |
parent | 01da3afd1e14ddeeb9cb2244e42f98bd60c10972 (diff) |
StopFinder: Re-use HAFAS.pm User Agent if possible
Diffstat (limited to 'lib/Travel/Status/DE/HAFAS/StopFinder.pm')
-rw-r--r-- | lib/Travel/Status/DE/HAFAS/StopFinder.pm | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Travel/Status/DE/HAFAS/StopFinder.pm b/lib/Travel/Status/DE/HAFAS/StopFinder.pm index c81c33a..3327af2 100644 --- a/lib/Travel/Status/DE/HAFAS/StopFinder.pm +++ b/lib/Travel/Status/DE/HAFAS/StopFinder.pm @@ -17,12 +17,13 @@ sub new { my ( $obj, %conf ) = @_; my $lang = $conf{language} // 'd'; + my $ua = $conf{ua}; - my %lwp_options = %{ $conf{lwp_options} // { timeout => 10 } }; - - my $ua = LWP::UserAgent->new(%lwp_options); - - $ua->env_proxy; + if ( not $ua ) { + my %lwp_options = %{ $conf{lwp_options} // { timeout => 10 } }; + $ua = LWP::UserAgent->new(%lwp_options); + $ua->env_proxy; + } my $reply; |