Loading bin/db-ris +2 −2 Original line number Diff line number Diff line Loading @@ -61,7 +61,7 @@ sub display_result { return; } for my $d ( $status->departures() ) { for my $d ( $status->results() ) { my ( @via, @via_main, @via_show ); Loading Loading @@ -130,7 +130,7 @@ version 0.0 =head1 DESCRIPTION db-riss is an interface to the DeutscheBahn arrival/departure monitor db-ris is an interface to the DeutscheBahn departure monitor available at L<http://reiseauskunft.bahn.de/bin/bhftafel.exe/dn>. It requests all departures at I<station> (optionally filtered by date, time, Loading lib/Travel/Status/DE/DeutscheBahn.pm +21 −24 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ use 5.010; use Carp qw(confess); use LWP::UserAgent; use POSIX qw(strftime); use Travel::Status::DE::DeutscheBahn::Departure; use Travel::Status::DE::DeutscheBahn::Result; use XML::LibXML; our $VERSION = '0.0'; Loading Loading @@ -81,7 +81,7 @@ sub new_from_html { return bless( $ref, $obj ); } sub departures { sub results { my ($self) = @_; my $mode = $self->{post}->{boardType}; Loading Loading @@ -139,20 +139,20 @@ sub departures { } push( @{ $self->{departures} }, Travel::Status::DE::DeutscheBahn::Departure->new( @{ $self->{results} }, Travel::Status::DE::DeutscheBahn::Result->new( time => $time, train => $train, route_raw => $route, route => \@via, destination => $dest, route_end => $dest, platform => $platform, info => $info, ) ); } return @{ $self->{departures} }; return @{ $self->{results} }; } 1; Loading @@ -162,7 +162,7 @@ __END__ =head1 NAME Travel::Status::DE::DeutscheBahn - Interface to the DeutscheBahn online departure monitor arrival/departure monitor =head1 SYNOPSIS Loading @@ -172,7 +172,7 @@ departure monitor station => 'Essen Hbf', ); for my $departure ($status->departures) { for my $departure ($status->results) { printf( "At %s: %s to %s from platform %s\n", $departure->time, Loading @@ -192,9 +192,9 @@ Travel::Status::DE::DeutscheBahn is an interface to the DeutscheBahn arrival/departure monitor available at L<http://reiseauskunft.bahn.de/bin/bhftafel.exe/dn>. It takes a station name and (optional) date and time and reports all departures at that station starting at the specified point in time (now if unspecified). By default, it will list the next 20 departures. It takes a station name and (optional) date and time and reports all arrivals or departures at that station starting at the specified point in time (now if unspecified). =head1 METHODS Loading Loading @@ -223,9 +223,6 @@ Time to report for. Defaults to now. By default, Travel::Status::DE::DeutscheBahn reports train departures (B<dep>). Set this to B<arr> to get arrivals instead. For arrivals, the C<departures()> method will report the arrival time, the train's origin and their route until the selected I<station>. =item B<mot> => I<\%hashref> Modes of transport to show. Accepted keys are: B<ice> (ICE trains), B<ic_ec> Loading @@ -240,10 +237,10 @@ By default, the following are shown: ice, ic_ec, d, nv, s. =back =item $status->departures() =item $status->results() Returns a list of departures (20 by default). Each list element is a Travel::Status::DE::DeutscheBahn::Departure(3pm) object. Returns a list of arrivals/departures. Each list element is a Travel::Status::DE::DeutscheBahn::Result(3pm) object. =back Loading @@ -269,7 +266,7 @@ Unknown. =head1 SEE ALSO mris(1), Travel::Status::DE::DeutscheBahn::Departure(3pm). mris(1), Travel::Status::DE::DeutscheBahn::Result(3pm). =head1 AUTHOR Loading lib/Travel/Status/DE/DeutscheBahn/Departure.pm→lib/Travel/Status/DE/DeutscheBahn/Result.pm +179 −0 Original line number Diff line number Diff line package Travel::Status::DE::DeutscheBahn::Departure; package Travel::Status::DE::DeutscheBahn::Result; use strict; use warnings; Loading @@ -8,8 +8,8 @@ use parent 'Class::Accessor'; our $VERSION = '0.0'; Travel::Status::DE::DeutscheBahn::Departure->mk_ro_accessors( qw(time train destination platform info)); Travel::Status::DE::DeutscheBahn::Result->mk_ro_accessors( qw(time train route_end platform info)); sub new { my ( $obj, %conf ) = @_; Loading @@ -19,6 +19,18 @@ sub new { return bless( $ref, $obj ); } sub destination { my ($self) = @_; return $self->{route_end}; } sub origin { my ($self) = @_; return $self->{route_end}; } sub route { my ($self) = @_; Loading @@ -31,12 +43,12 @@ __END__ =head1 NAME Travel::Status::DE::DeutscheBahn::Departure - Information about a single departure received by Travel::Status::DE::DeutscheBahn Travel::Status::DE::DeutscheBahn::Result - Information about a single arrival/departure received by Travel::Status::DE::DeutscheBahn =head1 SYNOPSIS for my $departure ($status->departures) { for my $departure ($status->results) { printf( "At %s: %s to %s from platform %s\n", $departure->time, Loading @@ -46,56 +58,74 @@ departure received by Travel::Status::DE::DeutscheBahn ); } # or (depending on module setup) for my $arrival ($status->results) { printf( "At %s: %s from %s on platform %s\n", $arrival->time, $arrival->train, $arrival->origin, $arrival->platform, ); } =head1 VERSION version 0.0 =head1 DESCRIPTION Travel::Status::DE::DeutscheBahn::Departure describes a single departure as obtained by Travel::Status::DE::DeutscheBahn. It contains information about the platform, departure time, destination and more. Travel::Status::DE::DeutscheBahn::Result describes a single arrival/departure as obtained by Travel::Status::DE::DeutscheBahn. It contains information about the platform, time, route and more. =head1 ACCESSORS =head1 METHODS =head2 ACCESSORS =over =item $departure->destination =item $result->route_end Returns the name of the destination station, e.g. "Dortmund Hbf". Returns the last element of the route. Depending on how you set up Travel::Status::DE::DeutscheBahn (arrival or departure listing), this is either the train's destination or its origin station. =item $departure->info For convenienc, this method can also be called as B<destination> or B<origin>. =item $result->info Returns additional information, usually wether the train is on time or delayed. =item $departure->platform =item $result->platform Returns the platform from which the train will depart. Returns the platform from which the train will depart / at which it will arrive. =item $departure->route =item $result->route Returns a list of station names the train will pass between the selected station and its destination. station and its origin/destination. =item $departure->time =item $result->time Returns the departure time as string in "hh:mm" format. Returns the arrival/departure time as string in "hh:mm" format. =item $departure->train =item $result->train Returns the line / train name, either in a format like "S 1" (S-Bahn line 1) or "RE 10111" (RegionalExpress train 10111, no line information). =back =head1 METHODS =head2 INTERNAL =over =item $departure = Travel::Status::DE::DeutscheBahn::Departure->new(I<%data>) =item $result = Travel::Status::DE::DeutscheBahn::Result->new(I<%data>) Returns a new Travel::Status::DE::DeutscheBahn::Departure object. Returns a new Travel::Status::DE::DeutscheBahn::Result object. You usually do not need to call this. Required I<data>: Loading @@ -110,7 +140,7 @@ Required I<data>: =item B<route> => I<arrayref> =item B<destination> => I<string> =item B<route_end> => I<string> =item B<platform> => I<string> Loading Loading
bin/db-ris +2 −2 Original line number Diff line number Diff line Loading @@ -61,7 +61,7 @@ sub display_result { return; } for my $d ( $status->departures() ) { for my $d ( $status->results() ) { my ( @via, @via_main, @via_show ); Loading Loading @@ -130,7 +130,7 @@ version 0.0 =head1 DESCRIPTION db-riss is an interface to the DeutscheBahn arrival/departure monitor db-ris is an interface to the DeutscheBahn departure monitor available at L<http://reiseauskunft.bahn.de/bin/bhftafel.exe/dn>. It requests all departures at I<station> (optionally filtered by date, time, Loading
lib/Travel/Status/DE/DeutscheBahn.pm +21 −24 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ use 5.010; use Carp qw(confess); use LWP::UserAgent; use POSIX qw(strftime); use Travel::Status::DE::DeutscheBahn::Departure; use Travel::Status::DE::DeutscheBahn::Result; use XML::LibXML; our $VERSION = '0.0'; Loading Loading @@ -81,7 +81,7 @@ sub new_from_html { return bless( $ref, $obj ); } sub departures { sub results { my ($self) = @_; my $mode = $self->{post}->{boardType}; Loading Loading @@ -139,20 +139,20 @@ sub departures { } push( @{ $self->{departures} }, Travel::Status::DE::DeutscheBahn::Departure->new( @{ $self->{results} }, Travel::Status::DE::DeutscheBahn::Result->new( time => $time, train => $train, route_raw => $route, route => \@via, destination => $dest, route_end => $dest, platform => $platform, info => $info, ) ); } return @{ $self->{departures} }; return @{ $self->{results} }; } 1; Loading @@ -162,7 +162,7 @@ __END__ =head1 NAME Travel::Status::DE::DeutscheBahn - Interface to the DeutscheBahn online departure monitor arrival/departure monitor =head1 SYNOPSIS Loading @@ -172,7 +172,7 @@ departure monitor station => 'Essen Hbf', ); for my $departure ($status->departures) { for my $departure ($status->results) { printf( "At %s: %s to %s from platform %s\n", $departure->time, Loading @@ -192,9 +192,9 @@ Travel::Status::DE::DeutscheBahn is an interface to the DeutscheBahn arrival/departure monitor available at L<http://reiseauskunft.bahn.de/bin/bhftafel.exe/dn>. It takes a station name and (optional) date and time and reports all departures at that station starting at the specified point in time (now if unspecified). By default, it will list the next 20 departures. It takes a station name and (optional) date and time and reports all arrivals or departures at that station starting at the specified point in time (now if unspecified). =head1 METHODS Loading Loading @@ -223,9 +223,6 @@ Time to report for. Defaults to now. By default, Travel::Status::DE::DeutscheBahn reports train departures (B<dep>). Set this to B<arr> to get arrivals instead. For arrivals, the C<departures()> method will report the arrival time, the train's origin and their route until the selected I<station>. =item B<mot> => I<\%hashref> Modes of transport to show. Accepted keys are: B<ice> (ICE trains), B<ic_ec> Loading @@ -240,10 +237,10 @@ By default, the following are shown: ice, ic_ec, d, nv, s. =back =item $status->departures() =item $status->results() Returns a list of departures (20 by default). Each list element is a Travel::Status::DE::DeutscheBahn::Departure(3pm) object. Returns a list of arrivals/departures. Each list element is a Travel::Status::DE::DeutscheBahn::Result(3pm) object. =back Loading @@ -269,7 +266,7 @@ Unknown. =head1 SEE ALSO mris(1), Travel::Status::DE::DeutscheBahn::Departure(3pm). mris(1), Travel::Status::DE::DeutscheBahn::Result(3pm). =head1 AUTHOR Loading
lib/Travel/Status/DE/DeutscheBahn/Departure.pm→lib/Travel/Status/DE/DeutscheBahn/Result.pm +179 −0 Original line number Diff line number Diff line package Travel::Status::DE::DeutscheBahn::Departure; package Travel::Status::DE::DeutscheBahn::Result; use strict; use warnings; Loading @@ -8,8 +8,8 @@ use parent 'Class::Accessor'; our $VERSION = '0.0'; Travel::Status::DE::DeutscheBahn::Departure->mk_ro_accessors( qw(time train destination platform info)); Travel::Status::DE::DeutscheBahn::Result->mk_ro_accessors( qw(time train route_end platform info)); sub new { my ( $obj, %conf ) = @_; Loading @@ -19,6 +19,18 @@ sub new { return bless( $ref, $obj ); } sub destination { my ($self) = @_; return $self->{route_end}; } sub origin { my ($self) = @_; return $self->{route_end}; } sub route { my ($self) = @_; Loading @@ -31,12 +43,12 @@ __END__ =head1 NAME Travel::Status::DE::DeutscheBahn::Departure - Information about a single departure received by Travel::Status::DE::DeutscheBahn Travel::Status::DE::DeutscheBahn::Result - Information about a single arrival/departure received by Travel::Status::DE::DeutscheBahn =head1 SYNOPSIS for my $departure ($status->departures) { for my $departure ($status->results) { printf( "At %s: %s to %s from platform %s\n", $departure->time, Loading @@ -46,56 +58,74 @@ departure received by Travel::Status::DE::DeutscheBahn ); } # or (depending on module setup) for my $arrival ($status->results) { printf( "At %s: %s from %s on platform %s\n", $arrival->time, $arrival->train, $arrival->origin, $arrival->platform, ); } =head1 VERSION version 0.0 =head1 DESCRIPTION Travel::Status::DE::DeutscheBahn::Departure describes a single departure as obtained by Travel::Status::DE::DeutscheBahn. It contains information about the platform, departure time, destination and more. Travel::Status::DE::DeutscheBahn::Result describes a single arrival/departure as obtained by Travel::Status::DE::DeutscheBahn. It contains information about the platform, time, route and more. =head1 ACCESSORS =head1 METHODS =head2 ACCESSORS =over =item $departure->destination =item $result->route_end Returns the name of the destination station, e.g. "Dortmund Hbf". Returns the last element of the route. Depending on how you set up Travel::Status::DE::DeutscheBahn (arrival or departure listing), this is either the train's destination or its origin station. =item $departure->info For convenienc, this method can also be called as B<destination> or B<origin>. =item $result->info Returns additional information, usually wether the train is on time or delayed. =item $departure->platform =item $result->platform Returns the platform from which the train will depart. Returns the platform from which the train will depart / at which it will arrive. =item $departure->route =item $result->route Returns a list of station names the train will pass between the selected station and its destination. station and its origin/destination. =item $departure->time =item $result->time Returns the departure time as string in "hh:mm" format. Returns the arrival/departure time as string in "hh:mm" format. =item $departure->train =item $result->train Returns the line / train name, either in a format like "S 1" (S-Bahn line 1) or "RE 10111" (RegionalExpress train 10111, no line information). =back =head1 METHODS =head2 INTERNAL =over =item $departure = Travel::Status::DE::DeutscheBahn::Departure->new(I<%data>) =item $result = Travel::Status::DE::DeutscheBahn::Result->new(I<%data>) Returns a new Travel::Status::DE::DeutscheBahn::Departure object. Returns a new Travel::Status::DE::DeutscheBahn::Result object. You usually do not need to call this. Required I<data>: Loading @@ -110,7 +140,7 @@ Required I<data>: =item B<route> => I<arrayref> =item B<destination> => I<string> =item B<route_end> => I<string> =item B<platform> => I<string> Loading