Commit 39949568 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

IRIS: use lwp_options in constructor

parent 5927366d
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
git HEAD

    * IRIS->new: Use lwp_options to explicitly pass arguments to the
      LWP::UserAgent constructor. Unknown arguments are now longer
      implicitly passed on

Travel::Status::DE::IRIS 0.10 - Tue Apr 30 2015
Travel::Status::DE::IRIS 0.10 - Tue Apr 30 2015


    * Result: Fix deep recursion error in TO_JSON
    * Result: Fix deep recursion error in TO_JSON
+8 −3
Original line number Original line Diff line number Diff line
@@ -19,7 +19,9 @@ use XML::LibXML;
sub new {
sub new {
	my ( $class, %opt ) = @_;
	my ( $class, %opt ) = @_;


	my $ua = LWP::UserAgent->new(%opt);
	my %lwp_options = %{ $opt{lwp_options} // { timeout => 10 } };

	my $ua = LWP::UserAgent->new( %{ $opt{lwp_options} } );


	if ( not $opt{station} ) {
	if ( not $opt{station} ) {
		confess('station flag must be passed');
		confess('station flag must be passed');
@@ -448,6 +450,11 @@ have no effect. However, as the IRIS occasionally contains unscheduled
departures or qos messages known far in advance (e.g. 12 hours from now), any
departures or qos messages known far in advance (e.g. 12 hours from now), any
non-negative integer is accepted.
non-negative integer is accepted.


=item B<lwp_options> => I<\%hashref>

Passed on to C<< LWP::UserAgent->new >>. Defaults to C<< { timeout => 10 } >>,
use an empty hashref to override.

=item B<station> => I<stationcode>
=item B<station> => I<stationcode>


Mandatory: Which station to return departures for. Note that this is not a
Mandatory: Which station to return departures for. Note that this is not a
@@ -457,8 +464,6 @@ name to code mapping.


=back
=back


All other options are passed to the LWP::UserAgent(3pm) constructor.

=item $status->errstr
=item $status->errstr


In case of a fatal HTTP request or IRIS error, returns a string describing it.
In case of a fatal HTTP request or IRIS error, returns a string describing it.