diff options
Diffstat (limited to 'lib/Travel/Status/DE/EFA')
-rw-r--r-- | lib/Travel/Status/DE/EFA/Line.pm | 6 | ||||
-rw-r--r-- | lib/Travel/Status/DE/EFA/Result.pm | 52 | ||||
-rw-r--r-- | lib/Travel/Status/DE/EFA/Stop.pm | 31 |
3 files changed, 44 insertions, 45 deletions
diff --git a/lib/Travel/Status/DE/EFA/Line.pm b/lib/Travel/Status/DE/EFA/Line.pm index 4f73aea..69526fd 100644 --- a/lib/Travel/Status/DE/EFA/Line.pm +++ b/lib/Travel/Status/DE/EFA/Line.pm @@ -6,7 +6,7 @@ use 5.010; use parent 'Class::Accessor'; -our $VERSION = '1.19'; +our $VERSION = '2.02'; Travel::Status::DE::EFA::Line->mk_ro_accessors( qw(direction mot name operator route type valid)); @@ -57,7 +57,7 @@ requested station =head1 VERSION -version 1.19 +version 2.02 =head1 DESCRIPTION @@ -151,7 +151,7 @@ Travel::Status::DE::EFA(3pm). =head1 AUTHOR -Copyright (C) 2011-2015 by Daniel Friesel E<lt>derf@finalrewind.orgE<gt> +Copyright (C) 2011-2023 by Birte Kristina Friesel E<lt>derf@finalrewind.orgE<gt> =head1 LICENSE diff --git a/lib/Travel/Status/DE/EFA/Result.pm b/lib/Travel/Status/DE/EFA/Result.pm index 0953242..11ff15a 100644 --- a/lib/Travel/Status/DE/EFA/Result.pm +++ b/lib/Travel/Status/DE/EFA/Result.pm @@ -4,15 +4,14 @@ use strict; use warnings; use 5.010; -no if $] >= 5.018, warnings => 'experimental::smartmatch'; - use parent 'Class::Accessor'; -our $VERSION = '1.19'; +our $VERSION = '2.02'; Travel::Status::DE::EFA::Result->mk_ro_accessors( - qw(countdown date delay destination is_cancelled info key line lineref - mot occupancy operator platform platform_db platform_name sched_date sched_time time train_no type) + qw(countdown datetime delay destination is_cancelled info key line lineref + mot occupancy operator platform platform_db platform_name rt_datetime + sched_datetime train_type train_name train_no type) ); my @mot_mapping = qw{ @@ -33,6 +32,8 @@ sub new { $ref->{is_cancelled} = 0; } + $ref->{datetime} = $ref->{rt_datetime} // $ref->{sched_datetime}; + return bless( $ref, $obj ); } @@ -128,14 +129,14 @@ departure received by Travel::Status::DE::EFA for my $departure ($status->results) { printf( "At %s: %s to %s from platform %d\n", - $departure->time, $departure->line, $departure->destination, - $departure->platform + $departure->datetime->strftime('%H:%M'), $departure->line, + $departure->destination, $departure->platform ); } =head1 VERSION -version 1.19 +version 2.02 =head1 DESCRIPTION @@ -147,20 +148,19 @@ line number and destination. =head2 ACCESSORS -"Actual" in the description means that the delay (if available) is already -included in the calculation, "Scheduled" means it isn't. - =over =item $departure->countdown -Actual time in minutes from now until the tram/bus/train will depart. +Time in minutes from now until the tram/bus/train will depart, including +realtime data if available. If delay information is available, it is already included. -=item $departure->date +=item $departure->datetime -Actual departure date (DD.MM.YYYY). +DateTime(3pm) object for departure date and time. Realtime data if available, +schedule data otherwise. =item $departure->delay @@ -213,8 +213,8 @@ Returns the "mode of transport", for instance "zug", "s-bahn", "tram" or Returns expected occupancy, if available, undef otherwise. Occupancy values are passed from the backend as-is. Known values are -"MANY_SEATS" (low occupation), "FEW_SEATS" (high occupation), and -"STANDING_ONLY" (very high occupation). +"MANY_SEATS" (low occupation), "FEW_SEATS" (high occupation), +"STANDING_ONLY" (very high occupation), and "FULL" (boarding not advised). =item $departure->platform @@ -244,17 +244,23 @@ Each station is a Travel::Status::DE::EFA::Stop(3pm) object. List of stations the vehicle will pass after this stop. Each station is a Travel::Status::DE::EFA::Stop(3pm) object. -=item $departure->sched_date +=item $departure->rt_datetime + +DateTime(3pm) object holding the departure date and time according to +realtime data. Undef if unknown / unavailable. + +=item $departure->sched_datetime -Scheduled departure date (DD.MM.YYYY). +DateTime(3pm) object holding the scheduled departure date and time. -=item $departure->sched_time +=item $departure->train_type -Scheduled departure time (HH:MM). +Train type, e.g. "ICE". Typically only defined for long-distance trains. -=item $departure->time +=item $departure->train_name -Actual departure time (HH:MM). +Train name, e.g. "ICE International" or "InterCityExpresS" or "Deichgraf". +Typically only defined for long-distance trains. =item $departure->train_no @@ -335,7 +341,7 @@ Travel::Status::DE::EFA(3pm). =head1 AUTHOR -Copyright (C) 2011-2015 by Daniel Friesel E<lt>derf@finalrewind.orgE<gt> +Copyright (C) 2011-2023 by Birte Kristina Friesel E<lt>derf@finalrewind.orgE<gt> =head1 LICENSE diff --git a/lib/Travel/Status/DE/EFA/Stop.pm b/lib/Travel/Status/DE/EFA/Stop.pm index 7e625ab..250b347 100644 --- a/lib/Travel/Status/DE/EFA/Stop.pm +++ b/lib/Travel/Status/DE/EFA/Stop.pm @@ -4,14 +4,12 @@ use strict; use warnings; use 5.010; -no if $] >= 5.018, warnings => 'experimental::smartmatch'; - use parent 'Class::Accessor'; -our $VERSION = '1.19'; +our $VERSION = '2.02'; Travel::Status::DE::EFA::Stop->mk_ro_accessors( - qw(arr_date arr_time dep_date dep_time name name_suf platform)); + qw(arr dep name name_suf platform)); sub new { my ( $obj, %conf ) = @_; @@ -41,14 +39,15 @@ in a Travel::Status::DE::EFA::Result's route for my $stop ($departure->route_post) { printf( "%s -> %s : %40s %s\n", - $stop->arr_time // q{ }, $stop->dep_time // q{ }, + $stop->arr ? $stop->arr->strftime('%H:%M') : q{--:--}, + $stop->dep ? $stop->dep->strftime('%H:%M') : q{--:--}, $stop->name, $stop->platform ); } =head1 VERSION -version 1.19 +version 2.02 =head1 DESCRIPTION @@ -62,21 +61,15 @@ delays or changed platforms are not taken into account. =over -=item $stop->arr_date - -arrival date (DD.MM.YYYY). undef if this is the first scheduled stop. - -=item $stop->arr_time - -arrival time (HH:MM). undef if this is the first scheduled stop. - -=item $stop->dep_date +=item $stop->arr -departure date (DD.MM.YYYY). undef if this is the final scehduled stop. +DateTime(3pm) object holding arrival date and time. undef if this is the +first scheduled stop. -=item $stop->dep_time +=item $stop->dep -departure time (HH:MM). undef if this is the final scehduled stop. +DateTime(3pm) object holding departure date and time. undef if this is the +final scheduled stop. =item $stop->name @@ -130,7 +123,7 @@ Travel::Status::DE::EFA(3pm). =head1 AUTHOR -Copyright (C) 2015 by Daniel Friesel E<lt>derf@finalrewind.orgE<gt> +Copyright (C) 2015-2023 by Birte Kristina Friesel E<lt>derf@finalrewind.orgE<gt> =head1 LICENSE |