summaryrefslogtreecommitdiff
path: root/lib/Travel/Status/DE/EFA.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Travel/Status/DE/EFA.pm')
-rw-r--r--lib/Travel/Status/DE/EFA.pm16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/Travel/Status/DE/EFA.pm b/lib/Travel/Status/DE/EFA.pm
index a895ca6..f8ea9f7 100644
--- a/lib/Travel/Status/DE/EFA.pm
+++ b/lib/Travel/Status/DE/EFA.pm
@@ -114,7 +114,9 @@ sub new {
$self->{xml} = $response->decoded_content;
- $self->{tree} = XML::LibXML->load_xml( string => $self->{xml}, );
+ $self->{tree} = XML::LibXML->load_xml(
+ string => $self->{xml},
+ );
#say $self->{tree}->toString(1);
@@ -126,9 +128,13 @@ sub new {
sub new_from_xml {
my ( $class, %opt ) = @_;
- my $self = { xml => $opt{xml}, };
+ my $self = {
+ xml => $opt{xml},
+ };
- $self->{tree} = XML::LibXML->load_xml( string => $self->{xml}, );
+ $self->{tree} = XML::LibXML->load_xml(
+ string => $self->{xml},
+ );
return bless( $self, $class );
}
@@ -277,6 +283,10 @@ sub results {
my ($self) = @_;
my @results;
+ if ( not $self->{tree} ) {
+ return;
+ }
+
my $xp_element = XML::LibXML::XPathExpression->new('//itdDeparture');
my $xp_date = XML::LibXML::XPathExpression->new('./itdDateTime/itdDate');