Daniel Friesel

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 0.04

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 $states = 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.

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.

All other options are passed to the LWP::UserAgent(3pm) constructor.

$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

Many backend features are not yet exposed.

SEE ALSO

db-iris(1), Travel::Status::DE::IRIS::Result(3pm), Travel::Status::DE::IRIS::Stations(3pm)

AUTHOR

Copyright (C) 2013-2014 by Daniel Friesel <derf@finalrewind.org>

LICENSE

This module is licensed under the same terms as Perl itself.




Hosting generously
sponsored by Bytemark