Travel::Routing::DE::EFA - unofficial interface to EFA-based itinerary services
use Travel::Routing::DE::EFA; my $efa = Travel::Routing::DE::EFA->new( efa_url => 'http://efa.vrr.de/vrr/XSLT_TRIP_REQUEST2', origin => [ 'Essen', 'HBf' ], destination => [ 'Duisburg', 'HBf' ], ); for my $route ( $efa->routes ) { for my $part ( $route->parts ) { printf( "%s at %s -> %s at %s, via %s to %s", $part->departure_time, $part->departure_stop, $part->arrival_time, $part->arrival_stop, $part->train_line, $part->train_destination, ); } print "\n\n"; }
version 2.07
Travel::Routing::DE::EFA is a client for EFA-based itinerary services. You pass it the start/stop of your journey, maybe a time and a date and more details, and it returns the up-to-date scheduled connections between those two stops.
It uses LWP::UserAgent and XML::LibXML for this.
Returns a new Travel::Routing::DE::EFA object and sets up its POST data via %opts.
Valid hash keys and their values are:
Mandatory. Sets the entry point to the EFA itinerary service. The following URLs (grouped by country) are known. A service marked with [!] is not completely supported yet and may not work at all.
Austria
http://efa.ivb.at/ivb/XSLT_TRIP_REQUEST2 (Innsbrucker Verkehsbetriebe)
http://efa.svv-info.at/sbs/XSLT_TRIP_REQUEST2 (Salzburger Verkehrsverbund)
http://efa.vor.at/wvb/XSLT_TRIP_REQUEST2 (Verkehrsverbund Ost-Region)
http://efaneu.vmobil.at/vvv/XSLT_TRIP_REQUEST2 (Vorarlberger Verkehrsverbund)
http://fahrplan.verbundlinie.at/stv/XSLT_TRIP_REQUEST2 (Verkehsverbund Steiermark) [!]
http://www.linzag.at/static/XSLT_TRIP_REQUEST2 (Linz AG) [!]
Germany
http://212.114.197.7/vgnExt_oeffi/XML_TRIP_REQUEST2 (Verkehrsverbund Großraum Nürnberg)
http://efa.vrr.de/vrr/XSLT_TRIP_REQUEST2 (Verkehrsverbund Rhein-Ruhr)
http://www2.vvs.de/vvs/XSLT_TRIP_REQUEST2 (Verkehrsverbund Stuttgart)
If you found a URL not listed here, please send it to <derf@finalrewind.org>.
Mandatory. Sets the start of the journey. type is optional and may be one of stop (default), address (street and house number) or poi ("point of interest").
Mandatory. Sets the end of the journey, see origin.
Optional. Specifies an intermediate stop which the resulting itinerary must contain. See origin for arguments.
Journey end time
Journey start time. Default: now
Journey date. Default: tdoay
Do not use certain transport types for itinerary. Accepted arguments: zug, s-bahn, u-bahn, stadtbahn, tram, stadtbus, regionalbus, schnellbus, seilbahn, schiff, ast, sonstige
Set maximum number of interchanges
Return up to num connections. If unset, the default of the respective EFA server is used (usually 4 or 5).
Prefer either fast connections (default), connections with low wait time or connections with little distance to walk
If true: Try using near stops instead of the specified origin/destination ones
Include only local trains into itinarery (default), all but ICEs, or all.
The latter two are usually way more expensive for short routes.
Set walk speed. Default: normal
If true: Prefer connections allowing passengers with bikes
Options to pass to LWP::UserAgent->new.
LWP::UserAgent->new
By default, new will create a POST request and submit it. If you do not want it to be submitted yet, set this to 0.
Submit the query to efa_url. %opts is passed on to LWP::UserAgent->new.
Returns a list of Travel::Routing::DE::EFA::Route(3pm) elements. Each one contains one method of getting from start to stop.
The following methods act like the arguments to new. See there.
Returns a list of known EFA entry points. Each list element is a reference to an array consisting of two strings. The first one is the URL (as passed to efa_url), the second describes the entity to which this URL belongs.
When encountering an error, Travel::Routing::DE::EFA throws a Travel::Routing::DE::EFA::Exception(3pm) object.
LWP::UserAgent(3pm)
XML::LibXML(3pm)
None known.
Travel::Routing::DE::EFA::Exception(3pm)
Travel::Routing::DE::EFA::Route(3pm)
WWW::EFA is another implementation, using Moose.
Copyright (C) 2009-2014 by Daniel Friesel <derf@finalrewind.org>
0. You just DO WHAT THE FUCK YOU WANT TO.
To install Travel::Routing::DE::VRR, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Travel::Routing::DE::VRR
CPAN shell
perl -MCPAN -e shell install Travel::Routing::DE::VRR
For more information on module installation, please visit the detailed CPAN module installation guide.