Loading bin/db-iris +21 −5 Original line number Diff line number Diff line Loading @@ -5,6 +5,8 @@ use 5.018; our $VERSION = '0.00'; use DateTime; use DateTime::Format::Strptime; use Encode qw(decode); use Getopt::Long qw(:config no_ignore_case); use List::Util qw(max); Loading @@ -14,6 +16,7 @@ use Travel::Status::DE::IRIS::Stations; my %train_type; my ( $date, $time ); my $datetime = DateTime->now( time_zone => 'Europe/Berlin' ); my $arrivals = 0; my $filter_via; my $ignore_late = 0; Loading Loading @@ -58,13 +61,26 @@ for my $type ( split( qr{,}, $types ) ) { } } if ($date) { my ( $day, $month, $year ) = split( /\./, $date ); $datetime->set( day => $day, month => $month, year => $year || $datetime->year, ); } if ($time) { my ( $hour, $minute, $second ) = split( /:/, $time ); $datetime->set( hour => $hour, minute => $minute, second => $second || $datetime->second, ); } my $status = Travel::Status::DE::IRIS->new( date => $date, language => $language, mot => \%train_type, datetime => $datetime, station => $station, time => $time, mode => $arrivals ? 'arr' : 'dep', ); sub get_station { Loading lib/Travel/Status/DE/IRIS.pm +4 −3 Original line number Diff line number Diff line Loading @@ -26,7 +26,8 @@ sub new { } my $self = { dt_now => DateTime->now( time_zone => 'Europe/Berlin' ), datetime => $opt{datetime} // DateTime->now( time_zone => 'Europe/Berlin' ), station => $opt{station}, user_agent => $ua, }; Loading @@ -47,7 +48,7 @@ sub new { $self->{nodes}{station} = ( $xml_st->findnodes('//station') )[0]; my $dt_req = $self->{dt_now}->clone; my $dt_req = $self->{datetime}->clone; for ( 1 .. 3 ) { $self->get_timetable( $self->{nodes}{station}->getAttribute('eva'), $dt_req ); Loading Loading @@ -231,7 +232,7 @@ sub errstr { sub results { my ($self) = @_; return @{ $self->{results} }; return @{ $self->{results} // [] }; } 1; Loading Loading
bin/db-iris +21 −5 Original line number Diff line number Diff line Loading @@ -5,6 +5,8 @@ use 5.018; our $VERSION = '0.00'; use DateTime; use DateTime::Format::Strptime; use Encode qw(decode); use Getopt::Long qw(:config no_ignore_case); use List::Util qw(max); Loading @@ -14,6 +16,7 @@ use Travel::Status::DE::IRIS::Stations; my %train_type; my ( $date, $time ); my $datetime = DateTime->now( time_zone => 'Europe/Berlin' ); my $arrivals = 0; my $filter_via; my $ignore_late = 0; Loading Loading @@ -58,13 +61,26 @@ for my $type ( split( qr{,}, $types ) ) { } } if ($date) { my ( $day, $month, $year ) = split( /\./, $date ); $datetime->set( day => $day, month => $month, year => $year || $datetime->year, ); } if ($time) { my ( $hour, $minute, $second ) = split( /:/, $time ); $datetime->set( hour => $hour, minute => $minute, second => $second || $datetime->second, ); } my $status = Travel::Status::DE::IRIS->new( date => $date, language => $language, mot => \%train_type, datetime => $datetime, station => $station, time => $time, mode => $arrivals ? 'arr' : 'dep', ); sub get_station { Loading
lib/Travel/Status/DE/IRIS.pm +4 −3 Original line number Diff line number Diff line Loading @@ -26,7 +26,8 @@ sub new { } my $self = { dt_now => DateTime->now( time_zone => 'Europe/Berlin' ), datetime => $opt{datetime} // DateTime->now( time_zone => 'Europe/Berlin' ), station => $opt{station}, user_agent => $ua, }; Loading @@ -47,7 +48,7 @@ sub new { $self->{nodes}{station} = ( $xml_st->findnodes('//station') )[0]; my $dt_req = $self->{dt_now}->clone; my $dt_req = $self->{datetime}->clone; for ( 1 .. 3 ) { $self->get_timetable( $self->{nodes}{station}->getAttribute('eva'), $dt_req ); Loading Loading @@ -231,7 +232,7 @@ sub errstr { sub results { my ($self) = @_; return @{ $self->{results} }; return @{ $self->{results} // [] }; } 1; Loading