Travel::Status::DE::EFA - unofficial EFA departure monitor
use Travel::Status::DE::EFA; my $status = Travel::Status::DE::EFA->new( service => 'VRR', name => 'Essen Helenenstr' ); for my $d ($status->results) { printf( "%s %-8s %-5s %s\n", $d->datetime->strftime('%H:%M'), $d->platform_name, $d->line, $d->destination ); }
version 3.03
Travel::Status::DE::EFA is an unofficial interface to EFA-based departure monitors.
It can serve as a departure monitor, request details about a specific trip/journey, and look up public transport stops by name or geolocation. The operating mode depends on its constructor arguments.
Requests data as specified by opts and returns a new Travel::Status::DE::EFA object. service and exactly one of coord, stopfinder, stopseq or name are mandatory. Dies if the wrong opts were passed.
Arguments:
EFA service. See efa-m --list
for known services.
If you found a service not listed there, please notify
<derf+efa@finalrewind.org>.
Look up stops in the vicinity of the given coordinates. hashref must contain a lon and a lat element providing WGS84 longitude/latitude.
Look up stops matching name.
Look up trip details. hashref must provide stateless (line ID), stop_id (stop ID used as start for the reported route), key (line trip number), and date (departure date as YYYYMMDD string).
List departure for address / point of interest / stop name.
Name of the place/city
Type of the following name. poi means "point of interest". Defaults to stop (stop/station name).
Request departures for the date/time specified by DateTime object. Default: now.
Some EFA servers do not correctly specify their response encoding. If you observe encoding issues, you can manually specify it here. Example: iso-8859-15.
If true: Request full routes for all departures from the backend. This enables the route_pre, route_post and route_interesting accessors in Travel::Status::DE::EFA::Departure(3pm).
If true: Show departures for stops in the proximity of the requested place as well.
Request timeout, the argument is passed on to LWP::UserAgent(3pm). Default: 10 seconds. Set to 0 or a negative value to disable it.
Returns a promise that resolves into a Travel::Status::DE::EFA instance ($status) on success and rejects with an error message on failure. In addition to the arguments of new, the following mandatory arguments must be set.
Promises implementation to use for internal promises as well as new_p return value. Recommended: Mojo::Promise(3pm).
User agent instance to use for asynchronous requests. The object must implement a post_p function. Recommended: Mojo::UserAgent(3pm).
In case of an HTTP request or EFA error, returns a string describing it. If none occured, returns undef.
Returns a list of Travel::Status::DE::EFA::Line(3pm) objects, each one describing one line servicing the selected station.
Returns a list of name candidates if name is ambiguous. Returns nothing (undef / empty list) otherwise.
Returns a list of place candidates if place is ambiguous. Returns nothing (undef / empty list) otherwise.
Returns a Travel::Status::DE::EFA::Stop(3pm) instance describing the requested stop.
In case the requested place/name is served by multiple stops and the backend provides a list of those: returns a list of Travel::Status::DE::EFA::Stop(3pm) instances describing each of them. Returns an empty list otherwise.
In departure monitor mode: returns a list of Travel::Status::DE::EFA::Departure(3pm) objects, each one describing one departure.
In coord or stopfinder mode: returns a list of Travel::Status::DE::EFA::Stop(3pm) objects.
In stopseq mode: Returns a Travel::Status::DE::EFA::Trip(3pm) object.
Returns the list of supported services (backends).
Returns a hashref describing the requested service ID with the following keys.
Provider name, e.g. Verkehrsverbund Oberelbe.
Backend base URL.
Provider homepage.
Supportde languages, e.g. de, en.
Area in which the service provides near-optimal coverage. Typically, this means a (nearly) complete list of departures and real-time data. The hashref contains two optional keys: area (GeoJSON) and regions (list of strings, e.g. "DE" or "CH-BE").
Returns a list of hashrefs describing all supported services. In addition to the keys listed above, each service contains a shortname (service ID).
None.
The API is not exposed completely.
efa-m(1), Travel::Status::DE::EFA::Departure(3pm).
Copyright (C) 2011-2024 by Birte Kristina Friesel <derf@finalrewind.org>
This module is licensed under the same terms as Perl itself.