From c84ddac4286d2c5d92bf6c7dd789c978083cc988 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 27 Jun 2011 15:57:01 +0200 Subject: Support arrivals as well as departures --- lib/Travel/Status/DE/DeutscheBahn.pm | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'lib/Travel') diff --git a/lib/Travel/Status/DE/DeutscheBahn.pm b/lib/Travel/Status/DE/DeutscheBahn.pm index 8407394..447715e 100644 --- a/lib/Travel/Status/DE/DeutscheBahn.pm +++ b/lib/Travel/Status/DE/DeutscheBahn.pm @@ -42,7 +42,7 @@ sub new { time => $conf{time} || $time, REQTrain_name => q{}, start => 'Suchen', - boardType => 'dep', + boardType => $conf{mode} // 'dep', }, }; @@ -83,9 +83,10 @@ sub new_from_html { sub departures { my ($self) = @_; + my $mode = $self->{post}->{boardType}; my $xp_element = XML::LibXML::XPathExpression->new( - '//table[@class="result stboard dep"]/tr'); + "//table[\@class=\"result stboard ${mode}\"]/tr"); my $xp_time = XML::LibXML::XPathExpression->new('./td[@class="time"]'); my $xp_train = XML::LibXML::XPathExpression->new('./td[@class="train"]'); my $xp_route = XML::LibXML::XPathExpression->new('./td[@class="route"]'); @@ -217,6 +218,14 @@ Date to report for. Defaults to the current day. Time to report for. Defaults to now. +=item B => B|B + +By default, Travel::Status::DE::DeutscheBahn reports train departures +(B). Set this to B to get arrivals instead. + +For arrivals, the C method will report the arrival time, the +train's origin and their route until the selected I. + =item B => I<\%hashref> Modes of transport to show. Accepted keys are: B (ICE trains), B @@ -256,8 +265,7 @@ None. =head1 BUGS AND LIMITATIONS -The web interface also offers arrival monitoring. This is not yet supported -in this module. +Unknown. =head1 SEE ALSO -- cgit v1.2.3