Loading bin/efa-m +19 −0 Changes for bin/efa-m: 19 added lines, 0 removed lines. Original line number Original line Diff line number Diff line Loading @@ -123,6 +123,7 @@ for my $efield (@edata_pre) { elsif ( $efield eq 'b' ) { $edata{route_before} = 1; $full_routes = 1 } elsif ( $efield eq 'b' ) { $edata{route_before} = 1; $full_routes = 1 } elsif ( $efield eq 'f' ) { $edata{fullroute} = 1; $full_routes = 1 } elsif ( $efield eq 'f' ) { $edata{fullroute} = 1; $full_routes = 1 } elsif ( $efield eq 'r' ) { $edata{route} = 1; $full_routes = 1 } elsif ( $efield eq 'r' ) { $edata{route} = 1; $full_routes = 1 } elsif ( $efield eq 'i' ) { $edata{info} = 1 } elsif ( $efield eq 'm' ) { $edata{messages} = 1 } elsif ( $efield eq 'm' ) { $edata{messages} = 1 } else { $edata{$efield} = 1 } else { $edata{$efield} = 1 } } } Loading Loading @@ -460,6 +461,18 @@ sub show_results { display_result(@output); display_result(@output); if ( $edata{info} ) { for my $info ( $efa->infos ) { say q{}; if ( $info->subject ) { printf( "# %s\n%s\n", $info->subtitle, $info->subject ); } else { printf( "# %s\n", $info->subtitle ); } } } return; return; } } Loading Loading @@ -659,6 +672,12 @@ requested station. Show each departure's full route (timestamps and stop names) before and Show each departure's full route (timestamps and stop names) before and after the requested station. after the requested station. =item i / info Show station-specific information messages. These typically relate to construction work, broken elevators or escalators, or special announcements for large-scale events. =item r / route =item r / route Show up to three stops between the requested station and the departure's Show up to three stops between the requested station and the departure's Loading lib/Travel/Status/DE/EFA.pm +18 −0 Changes for lib/Travel/Status/DE/EFA.pm: 18 added lines, 0 removed lines. Original line number Original line Diff line number Diff line Loading @@ -13,6 +13,7 @@ use DateTime::Format::Strptime; use Encode qw(encode); use Encode qw(encode); use JSON; use JSON; use Travel::Status::DE::EFA::Departure; use Travel::Status::DE::EFA::Departure; use Travel::Status::DE::EFA::Info; use Travel::Status::DE::EFA::Line; use Travel::Status::DE::EFA::Line; use Travel::Status::DE::EFA::Services; use Travel::Status::DE::EFA::Services; use Travel::Status::DE::EFA::Stop; use Travel::Status::DE::EFA::Stop; Loading Loading @@ -437,6 +438,23 @@ sub stops { return @stops; return @stops; } } sub infos { my ($self) = @_; if ( $self->{infos} ) { return @{ $self->{infos} }; } for my $info ( @{ $self->{response}{dm}{points}{point}{infos} // [] } ) { push( @{ $self->{infos} }, Travel::Status::DE::EFA::Info->new( json => $info ) ); } return @{ $self->{infos} // [] }; } sub lines { sub lines { my ($self) = @_; my ($self) = @_; Loading lib/Travel/Status/DE/EFA/Info.pm 0 → 100644 +93 −0 Changes for lib/Travel/Status/DE/EFA/Info.pm: 93 added lines, 0 removed lines. Original line number Original line Diff line number Diff line package Travel::Status::DE::EFA::Info; use strict; use warnings; use 5.010; use parent 'Class::Accessor'; our $VERSION = '3.01'; Travel::Status::DE::EFA::Info->mk_ro_accessors( qw(link_url link_text subject content subtitle additional_text)); sub new { my ( $obj, %opt ) = @_; my $json = $opt{json}; my $ref = { param => {}, link_url => $json->{infoLinkURL}, link_text => $json->{infoLinkText}, subject => $json->{infoText}{subject}, content => $json->{infoText}{content}, subtitle => $json->{infoText}{subtitle}, additional_text => $json->{infoText}{additionalText}, }; for my $param ( @{ $json->{paramList} // [] } ) { $ref->{param}{ $param->{name} } = $param->{value}; } return bless( $ref, $obj ); } sub TO_JSON { my ($self) = @_; return { %{$self} }; } 1; __END__ =head1 NAME Travel::Status::DE::EFA::Info - Information about a station =head1 SYNOPSIS =head1 VERSION version 3.01 =head1 DESCRIPTION Travel::Status::DE::EFA::Info describes a tram/bus/train line departing at the stop requested by Travel::Status::DE::EFA. Note that it only covers one direction, so in most cases, you get two Travel::Status::DE::EFA::Info objects per actual line. =head1 METHODS =head2 ACCESSORS =head1 DIAGNOSTICS None. =head1 DEPENDENCIES =over =item Class::Accessor(3pm) =back =head1 BUGS AND LIMITATIONS The B<route> accessor returns a simple string, an array might be better suited. =head1 SEE ALSO Travel::Status::DE::EFA(3pm). =head1 AUTHOR Copyright (C) 2024 by Birte Kristina Friesel E<lt>derf@finalrewind.orgE<gt> =head1 LICENSE This module is licensed under the same terms as Perl itself. Loading
bin/efa-m +19 −0 Changes for bin/efa-m: 19 added lines, 0 removed lines. Original line number Original line Diff line number Diff line Loading @@ -123,6 +123,7 @@ for my $efield (@edata_pre) { elsif ( $efield eq 'b' ) { $edata{route_before} = 1; $full_routes = 1 } elsif ( $efield eq 'b' ) { $edata{route_before} = 1; $full_routes = 1 } elsif ( $efield eq 'f' ) { $edata{fullroute} = 1; $full_routes = 1 } elsif ( $efield eq 'f' ) { $edata{fullroute} = 1; $full_routes = 1 } elsif ( $efield eq 'r' ) { $edata{route} = 1; $full_routes = 1 } elsif ( $efield eq 'r' ) { $edata{route} = 1; $full_routes = 1 } elsif ( $efield eq 'i' ) { $edata{info} = 1 } elsif ( $efield eq 'm' ) { $edata{messages} = 1 } elsif ( $efield eq 'm' ) { $edata{messages} = 1 } else { $edata{$efield} = 1 } else { $edata{$efield} = 1 } } } Loading Loading @@ -460,6 +461,18 @@ sub show_results { display_result(@output); display_result(@output); if ( $edata{info} ) { for my $info ( $efa->infos ) { say q{}; if ( $info->subject ) { printf( "# %s\n%s\n", $info->subtitle, $info->subject ); } else { printf( "# %s\n", $info->subtitle ); } } } return; return; } } Loading Loading @@ -659,6 +672,12 @@ requested station. Show each departure's full route (timestamps and stop names) before and Show each departure's full route (timestamps and stop names) before and after the requested station. after the requested station. =item i / info Show station-specific information messages. These typically relate to construction work, broken elevators or escalators, or special announcements for large-scale events. =item r / route =item r / route Show up to three stops between the requested station and the departure's Show up to three stops between the requested station and the departure's Loading
lib/Travel/Status/DE/EFA.pm +18 −0 Changes for lib/Travel/Status/DE/EFA.pm: 18 added lines, 0 removed lines. Original line number Original line Diff line number Diff line Loading @@ -13,6 +13,7 @@ use DateTime::Format::Strptime; use Encode qw(encode); use Encode qw(encode); use JSON; use JSON; use Travel::Status::DE::EFA::Departure; use Travel::Status::DE::EFA::Departure; use Travel::Status::DE::EFA::Info; use Travel::Status::DE::EFA::Line; use Travel::Status::DE::EFA::Line; use Travel::Status::DE::EFA::Services; use Travel::Status::DE::EFA::Services; use Travel::Status::DE::EFA::Stop; use Travel::Status::DE::EFA::Stop; Loading Loading @@ -437,6 +438,23 @@ sub stops { return @stops; return @stops; } } sub infos { my ($self) = @_; if ( $self->{infos} ) { return @{ $self->{infos} }; } for my $info ( @{ $self->{response}{dm}{points}{point}{infos} // [] } ) { push( @{ $self->{infos} }, Travel::Status::DE::EFA::Info->new( json => $info ) ); } return @{ $self->{infos} // [] }; } sub lines { sub lines { my ($self) = @_; my ($self) = @_; Loading
lib/Travel/Status/DE/EFA/Info.pm 0 → 100644 +93 −0 Changes for lib/Travel/Status/DE/EFA/Info.pm: 93 added lines, 0 removed lines. Original line number Original line Diff line number Diff line package Travel::Status::DE::EFA::Info; use strict; use warnings; use 5.010; use parent 'Class::Accessor'; our $VERSION = '3.01'; Travel::Status::DE::EFA::Info->mk_ro_accessors( qw(link_url link_text subject content subtitle additional_text)); sub new { my ( $obj, %opt ) = @_; my $json = $opt{json}; my $ref = { param => {}, link_url => $json->{infoLinkURL}, link_text => $json->{infoLinkText}, subject => $json->{infoText}{subject}, content => $json->{infoText}{content}, subtitle => $json->{infoText}{subtitle}, additional_text => $json->{infoText}{additionalText}, }; for my $param ( @{ $json->{paramList} // [] } ) { $ref->{param}{ $param->{name} } = $param->{value}; } return bless( $ref, $obj ); } sub TO_JSON { my ($self) = @_; return { %{$self} }; } 1; __END__ =head1 NAME Travel::Status::DE::EFA::Info - Information about a station =head1 SYNOPSIS =head1 VERSION version 3.01 =head1 DESCRIPTION Travel::Status::DE::EFA::Info describes a tram/bus/train line departing at the stop requested by Travel::Status::DE::EFA. Note that it only covers one direction, so in most cases, you get two Travel::Status::DE::EFA::Info objects per actual line. =head1 METHODS =head2 ACCESSORS =head1 DIAGNOSTICS None. =head1 DEPENDENCIES =over =item Class::Accessor(3pm) =back =head1 BUGS AND LIMITATIONS The B<route> accessor returns a simple string, an array might be better suited. =head1 SEE ALSO Travel::Status::DE::EFA(3pm). =head1 AUTHOR Copyright (C) 2024 by Birte Kristina Friesel E<lt>derf@finalrewind.orgE<gt> =head1 LICENSE This module is licensed under the same terms as Perl itself.