From 43f83fc7df3a563521af01dd1251ddd8e8d21d3a Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 11 Sep 2011 13:17:12 +0200 Subject: Add initial support for additional departure information --- lib/Travel/Status/DE/VRR.pm | 5 ++++- lib/Travel/Status/DE/VRR/Result.pm | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/Travel/Status/DE/VRR.pm b/lib/Travel/Status/DE/VRR.pm index ae1ef44..3a7375d 100644 --- a/lib/Travel/Status/DE/VRR.pm +++ b/lib/Travel/Status/DE/VRR.pm @@ -94,14 +94,16 @@ sub results { [ 'platform', './td[3]' ], [ 'line', './td[5]' ], [ 'dest', './td[7]' ], + [ 'info', './td[9]' ], ); @parts = map { [ $_->[0], XML::LibXML::XPathExpression->new( $_->[1] ) ] } @parts; for my $tr ( $self->{tree}->findnodes($xp_element) ) { - my ( $time, $platform, $line, $dest ) + my ( $time, $platform, $line, $dest, $info ) = map { ( $tr->findnodes( $_->[1] ) )[0]->textContent } @parts; + push( @results, Travel::Status::DE::VRR::Result->new( @@ -109,6 +111,7 @@ sub results { platform => $platform, line => $line, destination => $dest, + info => $info, ) ); } diff --git a/lib/Travel/Status/DE/VRR/Result.pm b/lib/Travel/Status/DE/VRR/Result.pm index 083e225..c5b74ff 100644 --- a/lib/Travel/Status/DE/VRR/Result.pm +++ b/lib/Travel/Status/DE/VRR/Result.pm @@ -9,7 +9,7 @@ use parent 'Class::Accessor'; our $VERSION = '0.00'; Travel::Status::DE::VRR::Result->mk_ro_accessors( - qw(destination time platform line)); + qw(destination time platform line info)); sub new { my ( $obj, %conf ) = @_; @@ -57,6 +57,12 @@ line number and destination. The tram/bus/train destination. +=item $departure->info + +Additional information related to the departure (string). If departures for +an address were requested, this is the stop name, otherwise it may be recent +news related to the line's schedule. + =item $departure->line The name/number of the line. -- cgit v1.2.3