NAME
Travel::Status::DE::HAFAS::Journey - Information about a single journey received by Travel::Status::DE::HAFAS
SYNOPSIS
for my $departure ($status->results) {
printf(
"At %s: %s to %s from platform %s\n",
$departure->datetime->strftime('%H:%M'),
$departure->line,
$departure->destination,
$departure->platform,
);
}
# or (depending on module setup)
for my $arrival ($status->results) {
printf(
"At %s: %s from %s on platform %s\n",
$arrival->datetime->strftime('%H:%M'),
$arrival->line,
$arrival->origin,
$arrival->platform,
);
}
VERSION
version 4.16
DESCRIPTION
Travel::Status::DE::HAFAS::Journey describes a single journey. It is either a station-specific arrival/departure obtained by a stationboard query, or a train journey that does not belong to a specific station.
stationboard-specific accessors are annotated with "(station only)" and return undef for non-station journeys.
METHODS
ACCESSORS
- $journey->name
-
Returns the journey or line name, either in a format like "Bus SB16" (Bus line SB16) or "RE 10111" (RegionalExpress train 10111, no line information). May contain extraneous whitespace characters.
- $journey->type
-
Returns the type of this journey, e.g. "S" for S-Bahn, "RE" for Regional Express or "STR" for tram / Straßenbahn.
- $journey->type_long
-
Returns the long type of this journey, e.g. "S-Bahn" or "Regional-Express".
- $journey->class
-
Returns an integer identifying the the mode of transport class. Semantics depend on backend, e.g. "1" and "2" for long-distance trains and "4" and "8" for regional trains.
- $journey->line
-
Returns the journey or line name, either in a format like "Bus SB16" (Bus line SB16), "RE 42" (RegionalExpress train 42) or "IC 2901" (InterCity train 2901, no line information). May contain extraneous whitespace characters. Note that this accessor does not return line informatikn for IC/ICE/EC services, even if it is available. Use line_no for those.
- $journey->line_no
-
Returns the line identifier, or undef if it is unknown. The line identifier may be a single number such as "11" (underground train line U 11), a single word (e.g. "AIR") or a combination (e.g. "SB16"). May also provide line numbers of IC/ICE services.
- $journey->number
-
Returns the journey number (e.g. train number), or undef if it is unknown.
- $journey->id
-
Returns tha HAFAS-internal journey ID.
- $journey->rt_datetime (station only)
-
DateTime object indicating the actual arrival/departure date and time. undef if no real-time data is available.
- $journey->sched_datetime (station only)
-
DateTime object indicating the scheduled arrival/departure date and time. undef if no schedule data is available.
- $journey->datetime (station only)
-
DateTime object indicating the arrival/departure date and time. Real-time data if available, schedule data otherwise. undef if neither is available.
- $journey->delay (station only)
-
Returns the delay in minutes, or undef if it is unknown. Also returns undef if the arrival/departure has been cancelled.
- $journey->is_cancelled
-
True if the journey was cancelled, false otherwise.
- $journey->is_partially_cancelled
-
True if part of the journey was cancelled, false otherwise.
- $journey->rt_platform (station only)
-
Actual arrival/departure platform. undef if no real-time data is available.
- $journey->sched_platform (station only)
-
Scheduled arrival/departure platform. undef if no scheduled platform is available.
- $journey->platform (station only)
-
Arrival/Departure platform. Real-time data if available, schedule data otherwise. May be undef.
- $journey->is_changed_platform (station only)
-
True if the real-time platform is known and it is not the scheduled one.
- $journey->load (station only)
-
Expected passenger load (i.e., how full the vehicle is) at the requested stop. If known, returns a hashref that maps classes (typically FIRST/SECOND) to load estimation numbers. The DB backend uses 1 (low to medium), 2 (high), 3 (very high), and 4 (exceptionally high, train is booked out). Undef if unknown.
- $journey->messages
-
Returns a list of message strings related to this journey. Messages usually are service notices (e.g. "missing carriage") or detailed delay reasons (e.g. "switch damage between X and Y, expect delays").
- $journey->operator
-
Returns the operator responsible for this journey. Returns undef if the backend does not provide an operator.
- $journey->station (station only)
-
Name of the station at which this journey was requested.
- $journey->station_eva (station only)
-
UIC/EVA ID of the station at which this journey was requested.
- $journey->route
-
Returns a list of Travel::Status::DE::HAFAS::Stop(3pm) objects that describe individual stops along the journey. In stationboard mode, the list only contains arrivals prior to the requested station or departures after the requested station. In journey mode, it contains the entire route.
- $journey->route_interesting([count])
-
Return up to count (default: 3) parts of
$journey->route
that may be particularly helpful, e.g. main stations or airports. Returns a list of hashes, see above for the layout. - $journey->route_end
-
Name of the last route station. In arrival mode, this is where the train started; in all other cases, it is the terminus.
- $journey->destination
-
Alias for route_end; only set when requesting departures in station mode.
- $journey->origin
-
Alias for route_end; only set when requesting arrivals in station mode.
- $journey->direction
-
Train direction; this is typically the text printed on the train itself. May be different from destination / route_end and may change along the route, see above.
- $journey->polyline (journey only)
-
List of geocoordinates that describe the train's route. Each list entry is a hash with the following keys.
lon (longitude)
lat (latitude)
name (name of stop at this location, if any. undef otherwise)
eva (EVA ID of stop at this location, if any. undef otherwise)
Note that stop locations in polyline may differ from the coordinates returned in route. This is a backend issue; Travel::Status::DE::HAFAS simply passes the returned coordinates on.
DIAGNOSTICS
None.
DEPENDENCIES
BUGS AND LIMITATIONS
None known.
SEE ALSO
Travel::Status::DE::HAFAS(3pm).
AUTHOR
Copyright (C) 2015-2022 by Birte Kristina Friesel <derf@finalrewind.org>
LICENSE
This module is licensed under the same terms as Perl itself.