Travel::Status::DE::IRIS - Interface to IRIS based web departure monitors.
use Travel::Status::DE::IRIS; use Travel::Status::DE::IRIS::Stations; # Get station code for "Essen Hbf" (-> "EE") my $station = (Travel::Status::DE::IRIS::Stations::get_station_by_name( 'Essen Hbf'))[0][0]; my $status = Travel::Status::DE::IRIS->new(station => $station); for my $r ($status->results) { printf( "%s %s +%-3d %10s -> %s\n", $r->date, $r->time, $r->delay || 0, $r->line, $r->destination ); }
version 1.07
Travel::Status::DE::IRIS is an unofficial interface to IRIS based web departure monitors such as https://iris.noncd.db.de/wbt/js/index.html?typ=ab&style=qrab&bhf=EE&SecLang=&Zeilen=20&footer=0&disrupt=0.
Requests schedule and realtime data for a specific station at a specific point in time. Returns a new Travel::Status::DE::IRIS object.
Arguments:
A DateTime(3pm) object specifying the point in time. Optional, defaults to the current date and time.
IRIS base url, defaults to http://iris.noncd.db.de/iris-tts/timetable.
http://iris.noncd.db.de/iris-tts/timetable
Compute only those results which are less than int minutes in the future. Default: 240 (4 hours).
Note that the DeutscheBahn IRIS backend only provides schedules up to four to five hours into the future, and this module only requests data for up to three hours. So in most cases, setting this to a value above 180 minutes will have no effect. However, as the IRIS occasionally contains unscheduled departures or qos messages known far in advance (e.g. 12 hours from now), any non-negative integer is accepted.
Passed on to LWP::UserAgent->new. Defaults to { timeout => 10 }, you can use an empty hashref to unset the default.
LWP::UserAgent->new
{ timeout => 10 }
Mandatory: Which station to return departures for. Note that this is not a station name, but a station code, such as "EE" (for Essen Hbf) or "KA" (for Aachen Hbf). See Travel::Status::DE::IRIS::Stations(3pm) for a name to code mapping.
Sometimes, Deutsche Bahn splits up major stations in the IRIS interface. For instance, "Köln Messe/Deutz" actually consists of "Köln Messe/Deutz" (KKDZ), "Köln Messe/Deutz Gl. 9-10" (KKDZB) and "Köln Messe/Deutz (tief)" (KKDT).
By default, Travel::Status::DE::IRIS only returns departures for the specified station. When this option is set to a true value, it will also return departures for all related stations.
In case of a fatal HTTP request or IRIS error, returns a string describing it. Returns undef otherwise.
Returns a list of Travel::Status::DE::IRIS(3pm) objects, each one describing one arrival and/or departure.
In case of a (probably) non-fatal HTTP request or IRIS error, returns a string describing it. Returns undef otherwise.
None.
DateTime(3pm)
List::Util(3pm)
LWP::UserAgent(3pm)
XML::LibXML(3pm)
Many backend features are not yet exposed.
db-iris(1), Travel::Status::DE::IRIS::Result(3pm), Travel::Status::DE::IRIS::Stations(3pm)
https://github.com/derf/Travel-Status-DE-IRIS
Copyright (C) 2013-2015 by Daniel Friesel <derf@finalrewind.org>
This module is licensed under the same terms as Perl itself.
To install Travel::Status::DE::IRIS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Travel::Status::DE::IRIS
CPAN shell
perl -MCPAN -e shell install Travel::Status::DE::IRIS
For more information on module installation, please visit the detailed CPAN module installation guide.