From 2c41eecea9d7d5ae563e0390514336e95b7c0c0a Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 10 Jan 2014 12:03:28 +0100 Subject: IRIS.pm: Errorhandling for stations without associated timetable --- lib/Travel/Status/DE/IRIS.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/Travel/Status/DE/IRIS.pm b/lib/Travel/Status/DE/IRIS.pm index e20d758..1e39377 100644 --- a/lib/Travel/Status/DE/IRIS.pm +++ b/lib/Travel/Status/DE/IRIS.pm @@ -49,6 +49,12 @@ sub new { $self->{nodes}{station} = ( $xml_st->findnodes('//station') )[0]; + if ( not $self->{node}->{station} ) { + $self->{errstr} + = "The station '$opt{station}' has no associated timetable"; + return $self; + } + my $dt_req = $self->{datetime}->clone; for ( 1 .. 3 ) { $self->get_timetable( $self->{nodes}{station}->getAttribute('eva'), -- cgit v1.2.3