Travel::Status::DE::DeutscheBahn - Interface to the DeutscheBahn online arrival/departure monitor
use Travel::Status::DE::DeutscheBahn; my $status = Travel::Status::DE::DeutscheBahn->new( station => 'Essen Hbf', ); if (my $err = $status->errstr) { die("Request error: ${err}\n"); } for my $departure ($status->results) { printf( "At %s: %s to %s from platform %s\n", $departure->time, $departure->line, $departure->destination, $departure->platform, ); }
version 1.02
Travel::Status::DE::DeutscheBahn is an interface to the DeutscheBahn arrival/departure monitor available at http://reiseauskunft.bahn.de/bin/bhftafel.exe/dn.
It takes a station name and (optional) date and time and reports all arrivals or departures at that station starting at the specified point in time (now if unspecified).
Requests the departures/arrivals as specified by opts and returns a new Travel::Status::DE::DeutscheBahn element with the results. Dies if the wrong opts were passed.
Supported opts are:
The train station to report for, e.g. "Essen HBf" or "Alfredusbad, Essen (Ruhr)". Mandatory.
Date to report for. Defaults to the current day.
Set language for additional information. Accepted arguments: deutsch, english, italian, n (dutch).
Time to report for. Defaults to now.
By default, Travel::Status::DE::DeutscheBahn reports train departures (dep). Set this to arr to get arrivals instead.
Modes of transport to show. Accepted keys are: ice (ICE trains), ic_ec (IC and EC trains), d (InterRegio and similarly fast trains), nv ("Nahverkehr", mostly RegionalExpress trains), s ("S-Bahn"), bus, ferry, u ("U-Bahn") and tram.
Setting a mode (as hash key) to 1 includes it, 0 excludes it. undef leaves it at the default.
By default, the following are shown: ice, ic_ec, d, nv, s.
In case of an error in the HTTP request, returns a string describing it. If no error occured, returns undef.
Returns a list of arrivals/departures. Each list element is a Travel::Status::DE::DeutscheBahn::Result(3pm) object.
If no matching results were found or the parser / http request failed, returns undef.
None.
Class::Accessor(3pm)
LWP::UserAgent(3pm)
XML::LibXML(3pm)
There are a few character encoding issues.
Travel::Status::DE::DeutscheBahn::Result(3pm).
Copyright (C) 2011 by Daniel Friesel <derf@finalrewind.org>
This module is licensed under the same terms as Perl itself.
To install Travel::Status::DE::DeutscheBahn, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Travel::Status::DE::DeutscheBahn
CPAN shell
perl -MCPAN -e shell install Travel::Status::DE::DeutscheBahn
For more information on module installation, please visit the detailed CPAN module installation guide.