diff options
-rw-r--r-- | lib/Travel/Status/DE/EFA.pm | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/lib/Travel/Status/DE/EFA.pm b/lib/Travel/Status/DE/EFA.pm index c9123df..0c2d1b2 100644 --- a/lib/Travel/Status/DE/EFA.pm +++ b/lib/Travel/Status/DE/EFA.pm @@ -271,6 +271,10 @@ sub check_for_ambiguous { sub identified_data { my ($self) = @_; + if ( not $self->{tree} ) { + return; + } + my $xp_place = XML::LibXML::XPathExpression->new('//itdOdv/itdOdvPlace/odvPlaceElem'); my $xp_name @@ -286,6 +290,14 @@ sub lines { my ($self) = @_; my @lines; + if ( $self->{lines} ) { + return @{ $self->{lines} }; + } + + if ( not $self->{tree} ) { + return; + } + my $xp_element = XML::LibXML::XPathExpression->new('//itdServingLines/itdServingLine'); @@ -293,10 +305,6 @@ sub lines { my $xp_route = XML::LibXML::XPathExpression->new('./itdRouteDescText'); my $xp_oper = XML::LibXML::XPathExpression->new('./itdOperator/name'); - if ( $self->{lines} ) { - return @{ $self->{lines} }; - } - for my $e ( $self->{tree}->findnodes($xp_element) ) { my $e_info = ( $e->findnodes($xp_info) )[0]; @@ -376,6 +384,10 @@ sub results { my ($self) = @_; my @results; + if ( $self->{results} ) { + return @{ $self->{results} }; + } + if ( not $self->{tree} ) { return; } @@ -394,10 +406,6 @@ sub results { my $xp_next_route = XML::LibXML::XPathExpression->new('./itdOnwardStopSeq/itdPoint'); - if ( $self->{results} ) { - return @{ $self->{results} }; - } - $self->lines; for my $e ( $self->{tree}->findnodes($xp_element) ) { |