Loading lib/Travel/Status/DE/DBRIS/Journey.pm +22 −0 Original line number Diff line number Diff line Loading @@ -227,6 +227,21 @@ sub trip_numbers { return @{ $self->{trip_numbers} // [] }; } sub trip_no_at { my ( $self, $loc, $ts ) = @_; for my $stop ( $self->route ) { if ( $stop->name eq $loc or $stop->eva eq $loc ) { if ( not defined $ts or not( $stop->sched_dep // $stop->sched_arr ) or ( $stop->sched_dep // $stop->sched_arr )->epoch == $ts ) { return $stop->trip_no; } } } return; } sub TO_JSON { my ($self) = @_; Loading Loading @@ -318,6 +333,13 @@ Textual description of the departure, typically consisting of type identifier Trip number, if available. undef otherwise. =item $journey->trip_no_at($stop, $epoch) Return trip number at I<$stop> (name or EVA ID), if available. Optionally, I<$epoch> can be used to only match stops where scheduled departure or arrival is equal to I<$epoch>. This is useful in case a trip passes the same stop multiple times. =item $journey->line_no Line identifier, if available. undef otherwise. Note that the line identifier Loading Loading
lib/Travel/Status/DE/DBRIS/Journey.pm +22 −0 Original line number Diff line number Diff line Loading @@ -227,6 +227,21 @@ sub trip_numbers { return @{ $self->{trip_numbers} // [] }; } sub trip_no_at { my ( $self, $loc, $ts ) = @_; for my $stop ( $self->route ) { if ( $stop->name eq $loc or $stop->eva eq $loc ) { if ( not defined $ts or not( $stop->sched_dep // $stop->sched_arr ) or ( $stop->sched_dep // $stop->sched_arr )->epoch == $ts ) { return $stop->trip_no; } } } return; } sub TO_JSON { my ($self) = @_; Loading Loading @@ -318,6 +333,13 @@ Textual description of the departure, typically consisting of type identifier Trip number, if available. undef otherwise. =item $journey->trip_no_at($stop, $epoch) Return trip number at I<$stop> (name or EVA ID), if available. Optionally, I<$epoch> can be used to only match stops where scheduled departure or arrival is equal to I<$epoch>. This is useful in case a trip passes the same stop multiple times. =item $journey->line_no Line identifier, if available. undef otherwise. Note that the line identifier Loading