From a99466f6b08f20d38b9de285223304e4b71f8fe4 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 7 Jan 2014 20:01:28 +0100 Subject: very limited date/time support (IRIS does not provide much past/future data) --- lib/Travel/Status/DE/IRIS.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/Travel/Status/DE/IRIS.pm b/lib/Travel/Status/DE/IRIS.pm index 6cec7d7..e6bccaf 100644 --- a/lib/Travel/Status/DE/IRIS.pm +++ b/lib/Travel/Status/DE/IRIS.pm @@ -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, }; @@ -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 ); @@ -231,7 +232,7 @@ sub errstr { sub results { my ($self) = @_; - return @{ $self->{results} }; + return @{ $self->{results} // [] }; } 1; -- cgit v1.2.3