Loading Changelog +2 −0 Original line number Diff line number Diff line git HEAD * Fix --track-via <stop> not matching trains changing their ID at <stop> * Do not errour out if only partial data is available, show partial data and a warning instead (closes #4) Travel::Status::DE::IRIS 0.03 - Fri Feb 14 2014 Loading bin/db-iris +8 −1 Original line number Diff line number Diff line Loading @@ -259,12 +259,19 @@ if ( my $err = $status->errstr ) { say STDERR "Request error: ${err}"; exit 2; } if ( my $warning = $status->warnstr ) { say STDERR "Request warning: ${warning}"; } if ( $status_via and $status_via->errstr ) { my $err = $status_via->errstr; say STDERR "Request error: ${err}"; say STDERR "Request error in --via : ${err}"; exit 2; } if ( $status_via and $status_via->warnstr ) { my $warning = $status_via->warnstr; say STDERR "Request warning in --via : ${warning}"; } sanitize_options(); Loading lib/Travel/Status/DE/IRIS.pm +18 −4 Original line number Diff line number Diff line Loading @@ -43,7 +43,8 @@ sub new { my $res_st = $ua->get( $self->{iris_base} . '/station/' . $opt{station} ); if ( $res_st->is_error ) { $self->{errstr} = $res_st->status_line; $self->{errstr} = 'Failed to fetch station data: Server returned ' . $res_st->status_line; return $self; } Loading Loading @@ -159,7 +160,8 @@ sub get_timetable { $dt->strftime( $self->{iris_base} . "/plan/${eva}/%y%m%d/%H" ) ); if ( $res->is_error ) { $self->{errstr} = $res->status_line; $self->{warnstr} = 'Failed to fetch a schedule part: Server returned ' . $res->status_line; return $self; } Loading @@ -184,7 +186,8 @@ sub get_realtime { my $res = $self->{user_agent}->get( $self->{iris_base} . "/fchg/${eva}" ); if ( $res->is_error ) { $self->{errstr} = $res->status_line; $self->{warnstr} = 'Failed to fetch realtime data: Server returned ' . $res->status_line; return $self; } Loading Loading @@ -282,6 +285,12 @@ sub results { return @{ $self->{results} // [] }; } sub warnstr { my ($self) = @_; return $self->{warnstr}; } 1; __END__ Loading Loading @@ -364,7 +373,7 @@ All other options are passed to the LWP::UserAgent(3pm) constructor. =item $status->errstr In case of an 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. Returns undef otherwise. =item $status->results Loading @@ -372,6 +381,11 @@ Returns undef otherwise. Returns a list of Travel::Status::DE::IRIS(3pm) objects, each one describing one arrival and/or departure. =item $status->errstr In case of a (probably) non-fatal HTTP request or IRIS error, returns a string describing it. Returns undef otherwise. =back =head1 DIAGNOSTICS Loading t/30-iris-const.t +1 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ $status = Travel::Status::DE::IRIS->new( ) ); ok( defined $status->errstr, 'constructor with missing data has errstr' ); ok( defined $status->warnstr, 'constructor with missing data has warnstr' ); $status = Travel::Status::DE::IRIS->new( iris_base => 'file:t/in', Loading Loading
Changelog +2 −0 Original line number Diff line number Diff line git HEAD * Fix --track-via <stop> not matching trains changing their ID at <stop> * Do not errour out if only partial data is available, show partial data and a warning instead (closes #4) Travel::Status::DE::IRIS 0.03 - Fri Feb 14 2014 Loading
bin/db-iris +8 −1 Original line number Diff line number Diff line Loading @@ -259,12 +259,19 @@ if ( my $err = $status->errstr ) { say STDERR "Request error: ${err}"; exit 2; } if ( my $warning = $status->warnstr ) { say STDERR "Request warning: ${warning}"; } if ( $status_via and $status_via->errstr ) { my $err = $status_via->errstr; say STDERR "Request error: ${err}"; say STDERR "Request error in --via : ${err}"; exit 2; } if ( $status_via and $status_via->warnstr ) { my $warning = $status_via->warnstr; say STDERR "Request warning in --via : ${warning}"; } sanitize_options(); Loading
lib/Travel/Status/DE/IRIS.pm +18 −4 Original line number Diff line number Diff line Loading @@ -43,7 +43,8 @@ sub new { my $res_st = $ua->get( $self->{iris_base} . '/station/' . $opt{station} ); if ( $res_st->is_error ) { $self->{errstr} = $res_st->status_line; $self->{errstr} = 'Failed to fetch station data: Server returned ' . $res_st->status_line; return $self; } Loading Loading @@ -159,7 +160,8 @@ sub get_timetable { $dt->strftime( $self->{iris_base} . "/plan/${eva}/%y%m%d/%H" ) ); if ( $res->is_error ) { $self->{errstr} = $res->status_line; $self->{warnstr} = 'Failed to fetch a schedule part: Server returned ' . $res->status_line; return $self; } Loading @@ -184,7 +186,8 @@ sub get_realtime { my $res = $self->{user_agent}->get( $self->{iris_base} . "/fchg/${eva}" ); if ( $res->is_error ) { $self->{errstr} = $res->status_line; $self->{warnstr} = 'Failed to fetch realtime data: Server returned ' . $res->status_line; return $self; } Loading Loading @@ -282,6 +285,12 @@ sub results { return @{ $self->{results} // [] }; } sub warnstr { my ($self) = @_; return $self->{warnstr}; } 1; __END__ Loading Loading @@ -364,7 +373,7 @@ All other options are passed to the LWP::UserAgent(3pm) constructor. =item $status->errstr In case of an 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. Returns undef otherwise. =item $status->results Loading @@ -372,6 +381,11 @@ Returns undef otherwise. Returns a list of Travel::Status::DE::IRIS(3pm) objects, each one describing one arrival and/or departure. =item $status->errstr In case of a (probably) non-fatal HTTP request or IRIS error, returns a string describing it. Returns undef otherwise. =back =head1 DIAGNOSTICS Loading
t/30-iris-const.t +1 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ $status = Travel::Status::DE::IRIS->new( ) ); ok( defined $status->errstr, 'constructor with missing data has errstr' ); ok( defined $status->warnstr, 'constructor with missing data has warnstr' ); $status = Travel::Status::DE::IRIS->new( iris_base => 'file:t/in', Loading