NAME

Travel::Status::DE::EFA::Result - Information about a single departure received by Travel::Status::DE::EFA

SYNOPSIS

    for my $departure ($status->results) {
        printf(
            "At %s: %s to %s from platform %d\n",
            $departure->datetime->strftime('%H:%M'), $departure->line,
            $departure->destination, $departure->platform
        );
    }

VERSION

version 2.00

DESCRIPTION

Travel::Status::DE::EFA::Result describes a single departure as obtained by Travel::Status::DE::EFA. It contains information about the time, platform, line number and destination.

METHODS

ACCESSORS

$departure->countdown

Time in minutes from now until the tram/bus/train will depart, including realtime data if available.

If delay information is available, it is already included.

$departure->datetime

DateTime(3pm) object for departure date and time. Realtime data if available, schedule data otherwise.

$departure->delay

Expected delay from scheduled departure time in minutes. A delay of 0 indicates departure on time. undef when no realtime information is available.

$departure->destination

Destination name.

$departure->info

Additional information related to the departure (string). If departures for an address were requested, this is the stop name, otherwise it may be recent news related to the line's schedule. If no information is available, returns an empty string.

$departure->is_cancelled

1 if the departure got cancelled, 0 otherwise.

$departure->key

Unknown. Unlike the name may suggest, this is not a unique key / UUID for a departure: On the same day, different lines departing at the same station may have the same key. It might, however, be unique when combined with the line information.

$departure->line

The name/number of the line.

$departure->lineref

Travel::Status::DE::EFA::Line(3pm) object describing the departing line in detail.

$departure->mot

Returns the "mode of transport" number. This is usually an integer between 0 and 11.

$departure->mot_name

Returns the "mode of transport", for instance "zug", "s-bahn", "tram" or "sonstige".

$departure->occupancy

Returns expected occupancy, if available, undef otherwise.

Occupancy values are passed from the backend as-is. Known values are "MANY_SEATS" (low occupation), "FEW_SEATS" (high occupation), and "STANDING_ONLY" (very high occupation).

$departure->platform

Departure platform number (may not be a number).

$departure->platform_db

true if the platform number is operated by DB ("Gleis x"), false ("Bstg. x") otherwise.

Unfortunately, there is no distinction between tram and bus platforms yet, which may also have the same numbers.

$departure->route_interesting

List of up to three "interesting" stations served by this departure. Is a subset of route_post. Each station is a Travel::Status::DE::EFA::Stop(3pm) object.

$departure->route_pre

List of stations the vehicle passed (or will have passed) before this stop. Each station is a Travel::Status::DE::EFA::Stop(3pm) object.

$departure->route_post

List of stations the vehicle will pass after this stop. Each station is a Travel::Status::DE::EFA::Stop(3pm) object.

$departure->rt_datetime

DateTime(3pm) object holding the departure date and time according to realtime data. Undef if unknown / unavailable.

$departure->sched_datetime

DateTime(3pm) object holding the scheduled departure date and time.

$departure->train_type

Train type, e.g. "ICE". Typically only defined for long-distance trains.

$departure->train_name

Train name, e.g. "ICE International" or "InterCityExpresS" or "Deichgraf". Typically only defined for long-distance trains.

$departure->train_no

Train number. Only defined if departure is a train.

$departure->type

Type of the departure. Note that efa.vrr.de sometimes puts bogus data in this field. See DEPARTURE TYPES.

INTERNAL

$departure = Travel::Status::DE::EFA::Result->new(%data)

Returns a new Travel::Status::DE::EFA::Result object. You should not need to call this.

$departure->TO_JSON

Allows the object data to be serialized to JSON.

DEPARTURE TYPES

The following are known so far:

* Abellio-Zug
* Bus
* Eurocity
* Intercity-Express
* NE (NachtExpress / night bus)
* Niederflurbus
* R-Bahn (RE / RegionalExpress)
* S-Bahn
* SB (Schnellbus)
* Straßenbahn
* U-Bahn

DIAGNOSTICS

None.

DEPENDENCIES

Class::Accessor(3pm)

BUGS AND LIMITATIONS

$result->type may contain bogus data. This comes from the efa.vrr.de interface.

SEE ALSO

Travel::Status::DE::EFA(3pm).

AUTHOR

Copyright (C) 2011-2023 by Birte Kristina Friesel <derf@finalrewind.org>

LICENSE

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