NAME
Travel::Status::DE::IRIS - Interface to IRIS based web departure monitors.
SYNOPSIS
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
version 1.11
DESCRIPTION
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.
METHODS
- my $status = Travel::Status::DE::IRIS->new(%opt)
-
Requests schedule and realtime data for a specific station at a specific point in time. Returns a new Travel::Status::DE::IRIS object.
Arguments:
- datetime => datetime-obj
-
A DateTime(3pm) object specifying the point in time. Optional, defaults to the current date and time.
- iris_base => url
-
IRIS base url, defaults to
http://iris.noncd.db.de/iris-tts/timetable
. - lookahead => int
-
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.
- lwp_options => \%hashref
-
Passed on to
LWP::UserAgent->new
. Defaults to{ timeout => 10 }
, you can use an empty hashref to unset the default. - main_cache => $ojj
-
A Cache::File(3pm) object used to cache station and timetable requests. Optional.
- realtime_cache => $ojj
-
A Cache::File(3pm) object used to cache realtime data requests. Optional.
- station => stationcode
-
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.
- $status->errstr
-
In case of a fatal HTTP request or IRIS error, returns a string describing it. Returns undef otherwise.
- $status->results
-
Returns a list of Travel::Status::DE::IRIS(3pm) objects, each one describing one arrival and/or departure.
- $status->warnstr
-
In case of a (probably) non-fatal HTTP request or IRIS error, returns a string describing it. Returns undef otherwise.
DIAGNOSTICS
None.
DEPENDENCIES
DateTime(3pm)
List::Util(3pm)
LWP::UserAgent(3pm)
XML::LibXML(3pm)
BUGS AND LIMITATIONS
Some backend features are not yet exposed.
SEE ALSO
db-iris(1), Travel::Status::DE::IRIS::Result(3pm), Travel::Status::DE::IRIS::Stations(3pm)
REPOSITORY
https://github.com/derf/Travel-Status-DE-IRIS
AUTHOR
Copyright (C) 2013-2016 by Daniel Friesel <derf@finalrewind.org>
LICENSE
This module is licensed under the same terms as Perl itself.