The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Travel::Status::DE::URA - unofficial departure monitor for URA-based realtime data providers (e.g. ASEAG)

SYNOPSIS

    use Travel::Status::DE::URA;

    my $status = Travel::Status::DE::URA->new(
        ura_base => 'http://ivu.aseag.de/interfaces/ura',
        ura_version => '1',
        stop => 'Bushof'
    );

    for my $d ($status->results) {
        printf(
            "%s  %-5s %25s (in %d min)\n",
            $d->time, $d->line, $d->destination, $d->countdown
        );
    }

VERSION

version 0.01

DESCRIPTION

Travel::Status::DE::URA is an unofficial interface URA-based realtime departure monitors (as used e.g. by the ASEAG). It reports all upcoming departures at a given place in real-time. Schedule information is not included.

METHODS

my $status = Travel::Status::DE::URA->new(%opt)

Requests the departures as specified by opts and returns a new Travel::Status::DE::URA object.

The following two parameters are mandatory:

ura_base => ura_base

The URA base url.

ura_version => version

The version, may be any string.

The request URL is ura_base/instant_Vversion, so for http://ivu.aseag.de/interfaces/ura, 1 this module will point requests to http://ivu.aseag.de/interfaces/ura/instant_V1.

Additionally, all options supported by $status->results may be specified here, causing them to be used as defaults. Note that while they may be overridden later, they may limit the set of available departures requested from the server.

$status->errstr

In case of an HTTP request error, returns a string describing it. If none occured, returns undef.

$status->results(%opt)

Returns a list of Travel::Status::DE::URA::Result(3pm) objects, each describing one departure.

Accepted parameters (all are optional):

full_routes => before|after|bool (default 0)

When set to a true value: Compute route_timetable fields in all Travel::Status::DE::URA::Result(3pm) objects, otherwise they will not be set.

before / after limits the timetable to stops before / after the stop name (if set).

fuzzy => bool (default 1)

A true value allows fuzzy matching for the stop name, a false one requires an exact string match.

hide_past => bool (default 1)

Do not include past departures in the result list and the computed timetables.

stop => name

Only return departures at stop name.

via => vianame

Only return departures containing vianame in their route. If stop is set, vianame must be in the route after the stop name. If, in addition to that, full_routes is set to before, vianame must be in the route before the stop name. Respects fuzzy. Implies full_routes> => 'after' unless full_routes is explicitly set to before / after / 1.

DIAGNOSTICS

None.

DEPENDENCIES

  • Class::Accessor(3pm)

  • DateTime(3pm)

  • List::MoreUtils(3pm)

  • LWP::UserAgent(3pm)

BUGS AND LIMITATIONS

Many.

SEE ALSO

Travel::Status::DE::URA::Result(3pm).

AUTHOR

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

LICENSE

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