summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2013-12-17 18:43:50 +0100
committerDaniel Friesel <derf@finalrewind.org>2013-12-17 18:43:50 +0100
commit6c733a1bcc425fc4600127414103fde217b8ae87 (patch)
tree9bb023aa9d4b941ab8598bd9fa827818fc7efd7c
parent2c239b7e8e7ac9ba82989afbd6639231e531a2f5 (diff)
support lines without operator field
-rw-r--r--Changelog1
-rw-r--r--lib/Travel/Status/DE/VRR.pm4
-rw-r--r--lib/Travel/Status/DE/VRR/Line.pm3
3 files changed, 5 insertions, 3 deletions
diff --git a/Changelog b/Changelog
index e99a875..f35f35b 100644
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,7 @@
git HEAD
* Add -r, --relative option to use relative times
+ * Support lines without Operator field (e.g. Aachen / ASEAG)
Travel::Status::DE::VRR 1.04 - Wed Oct 16 2013
diff --git a/lib/Travel/Status/DE/VRR.pm b/lib/Travel/Status/DE/VRR.pm
index d207179..eb8212e 100644
--- a/lib/Travel/Status/DE/VRR.pm
+++ b/lib/Travel/Status/DE/VRR.pm
@@ -237,7 +237,7 @@ sub lines {
my $e_route = ( $e->findnodes($xp_route) )[0];
my $e_oper = ( $e->findnodes($xp_oper) )[0];
- if ( not( $e_info and $e_oper ) ) {
+ if ( not($e_info) ) {
cluck( 'node with insufficient data. This should not happen. '
. $e->getAttribute('number') );
next;
@@ -248,7 +248,7 @@ sub lines {
my $valid = $e->getAttribute('valid');
my $type = $e_info->getAttribute('name');
my $route = ( $e_route ? $e_route->textContent : undef );
- my $operator = $e_oper->textContent;
+ my $operator = ( $e_oper ? $e_oper->textContent : undef );
my $identifier = $e->getAttribute('stateless');
push(
diff --git a/lib/Travel/Status/DE/VRR/Line.pm b/lib/Travel/Status/DE/VRR/Line.pm
index b22c96e..62582c3 100644
--- a/lib/Travel/Status/DE/VRR/Line.pm
+++ b/lib/Travel/Status/DE/VRR/Line.pm
@@ -72,11 +72,12 @@ Name of the line, e.g. "U11", "SB15", "107".
=item $line->operator
Operator of the line, as in the local transit company responsible for it.
+May be undefined.
=item $line->route
Partial route of the line (as string), usually start and destination with two
-stops in between.
+stops in between. May be undefined.
Note that start means the actual start of the line, the stop requested by
Travel::Status::DE::VRR::Line may not even be included in this listing.