Scroll to navigation

Travel::Routing::DE::VRR(3pm) User Contributed Perl Documentation Travel::Routing::DE::VRR(3pm)

NAME

Travel::Routing::DE::VRR - unofficial interface to the efa.vrr.de German itinerary service

SYNOPSIS

        use Travel::Routing::DE::VRR;
        my $efa = Travel::Routing::DE::VRR->new(
                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

version 2.01

DESCRIPTION

Travel::Routing::DE::VRR 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.

METHODS

$efa = Travel::Routing::DE::VRR->new(%opts)
Returns a new Travel::Routing::DE::VRR object and sets up its POST data via %opts.
 
Valid hash keys and their values are:
origin => [ city, stop [ , type ] ]
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").
destination => [ city, stop [ , type ] ]
Mandatory. Sets the end of the journey, see origin.
via => [ city, stop [ , type ] ]
Optional. Specifies an intermediate stop which the resulting itinerary must contain. See origin for arguments.
arrival_time => HH:MM
Journey end time
departure_time => HH:MM
Journey start time. Default: now
date => DD.MM.[YYYY]
Journey date. Default: tdoay
exclude => \@exclude
Do not use certain transport types for itinerary. Accepted arguments: zug, s-bahn, u-bahn, stadtbahn, tram, stadtbus, regionalbus, schnellbus, seilbahn, schiff, ast, sonstige
max_interchanges => num
Set maximum number of interchanges
select_interchange_by => speed|waittime| distance
Prefer either fast connections (default), connections with low wait time or connections with little distance to walk
use_near_stops => 0|1
If true: Try using near stops instead of the specified origin/destination ones
train_type => local|ic|ice
Include only local trains into itinarery (default), all but ICEs, or all.
 
The latter two are usually way more expensive for short routes.
walk_speed => slow|fast|normal
Set walk speed. Default: normal
with_bike => 0|1
If true: Prefer connections allowing passengers with bikes
lwp_options => \%hashref
Options to pass to "LWP::UserAgent->new".
submit => 0|1
By default, new will create a POST request and submit it to <http://efa.vrr.de>. If you do not want it to be submitted yet, set this to 0.
$efa->submit(%opts)
Submit the query to <http://efa.vrr.de>. %opts is passed on to "LWP::UserAgent->new".
$efa->routes()
Returns a list of Travel::Routing::DE::VRR::Route(3pm) elements. Each one contains one method of getting from start to stop.

ACCESSORS

The following methods act like the arguments to new. See there.
$efa->departure_time($time)
$efa->arrival_time($time)
$efa->date($date)
$efa->exclude(@exclude)
$efa->max_interchanges($num)
$efa->select_interchange_by($selection)
$efa->train_type($type)
$efa->use_near_stops($bool)
$efa->walk_speed($speed)
$efa->with_bike($bool)

DIAGNOSTICS

When encountering an error, Travel::Routing::DE::VRR throws a Travel::Routing::DE::VRR::Exception(3pm) object.

DEPENDENCIES

LWP::UserAgent(3pm)
XML::LibXML(3pm)

BUGS AND LIMITATIONS

It is best not to pass Unicode characters to Travel::Routing::DE::VRR.

SEE ALSO

Travel::Routing::DE::VRR::Exception(3pm)
Travel::Routing::DE::VRR::Route(3pm)

AUTHOR

Copyright (C) 2009-2011 by Daniel Friesel <derf@finalrewind.org>

LICENSE

  0. You just DO WHAT THE FUCK YOU WANT TO.
2012-01-28 perl v5.14.2