diff options
Diffstat (limited to 'lib/Travel/Status/DE/DeutscheBahn')
-rw-r--r-- | lib/Travel/Status/DE/DeutscheBahn/Result.pm | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/Travel/Status/DE/DeutscheBahn/Result.pm b/lib/Travel/Status/DE/DeutscheBahn/Result.pm index 6eb7450..43ce27b 100644 --- a/lib/Travel/Status/DE/DeutscheBahn/Result.pm +++ b/lib/Travel/Status/DE/DeutscheBahn/Result.pm @@ -11,7 +11,7 @@ use parent 'Class::Accessor'; our $VERSION = '1.04'; Travel::Status::DE::DeutscheBahn::Result->mk_ro_accessors( - qw(date time train route_end route_raw platform info_raw)); + qw(date time train route_end route_raw platform info_raw routeinfo_raw)); sub new { my ( $obj, %conf ) = @_; @@ -85,6 +85,17 @@ sub route { return @stops; } +sub route_info { + my ($self) = @_; + + my $route_info = $self->routeinfo_raw; + + $route_info =~ s{ ^ [\s\n]+ }{}x; + $route_info =~ s{ [\s\n]+ $ }{}x; + + return $route_info; +} + sub route_interesting { my ( $self, $max_parts ) = @_; @@ -93,7 +104,7 @@ sub route_interesting { $max_parts //= 3; for my $stop (@via) { - if ( $stop =~ m{ ?Hbf}o ) { + if ( $stop =~ m{ Hbf | Flughafen }ox ) { push( @via_main, $stop ); } } @@ -278,6 +289,11 @@ B<route_raw>. Similar to B<route>. however, this function returns a list of array references of the form C<< [ arrival time, station name ] >>. +=item $result->route_info + +Returns a string containing information related to the train's route, such as +"landslide between X and Y, expect delays". + =item $result->time Returns the arrival/departure time as string in "hh:mm" format. |