WWW::Efa - inofficial interface to the efa.vrr.de German itinerary service
use WWW::Efa; my $efa = WWW::Efa->new( from => ['Essen', 'HBf'], to => ['Duisburg', 'HBf'], ); $efa->submit(); $efa->parse(); for my $con ($efa->connections()) { for my $c (@{$con}) { printf( "%-5s ab %-30s %-20s %s\n%-5s an %-30s\n\n",, @{$c}{'dep_time', 'dep_stop', 'train_line', 'train_dest'}, @{$c}{'arr_time', 'arr_stop'}, ); } print "\n\n"; }
WWW::Efa is a client for the efa.vrr.de web interface. 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 WWW::Efa object and sets up its POST data via %conf.
Valid hash keys and their values are:
Mandatory. Sets the origin, which is 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 destination, see from.
Optional. Specifies a intermediate stop which the resulting itinerary must contain. See from for arguments.
Sets the journey end time
Sets the journey start time
Set journey date, in case it is not today
Do not use certain transport types for itinerary. Acceptep arguments: zug, s-bahn, u-bahn, stadtbahn, tram, stadtbus, regionalbus, schnellbus, seilbahn, schiff, ast, sonstige
Set maximum number of interchanges
Prefer either fast connections (default), connections with low wait time or connections with little distance to walk
Try using near stops instead of the given start/stop one if int is true.
Include only local trains into itinarery (default), or all but ICEs, or all.
Set walk speed. Default: normal
If true: Prefer connections allowing to take a bike along
When encountering invalid hash keys, a WWW::Efa::Error object is stored to be retrieved by $efa->error();
In case a WWW::Efa operation encountered an error, this returns a WWW::Efa::Error object related to the exact error. Otherwise, returns undef.
Submit the query to http://efa.vrr.de. %opts is passed on to LWP::UserAgent->new(%opts).
Parse the efa.vrr.de reply. returns a true value on success. Upon failure, returns undef and sets $efa->error() to a WWW::Efa::Error object.
Returns an array of connection elements. Each connection element is an arrayref of connection part, and each connecton part is a hash containing the following elements:
Departure time as a string in HH:MM format
Departure stop, e.g. "Essen HBf"
Name of the train line, e.g. "S-Bahn S6"
Arrival time as a string in HH:MM format
Arrival stop, e.g. "Berlin HBf"