Travel...E::EFA(3pm)
β¨ NAME β¨
okay bestie, gather round π this is Travel::Routing::DE::EFA β your unofficial little backstage pass to EFA-based itinerary services. it's a Perl module, it lives in the (3pm) section of the manual, and it is so ready to plan your train journey for you πβ¨
πΈ SYNOPSIS πΈ
use Travel::Routing::DE::EFA;
my $efa = Travel::Routing::DE::EFA->new(
efa_url => 'https://app.vrr.de/vrrstd/XML_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\n",
$part->departure_time, $part->departure_stop,
$part->arrival_time, $part->arrival_stop,
$part->train_line, $part->train_destination,
);
}
print "\n";
}
like, look at that. that's the whole vibe right there π«Ά you build the object, you loop the routes, you loop the parts, you print. iconic.
π VERSION π
version 2.24 β she's on 2.24, no cap β
π¦ DESCRIPTION π¦
Travel::Routing::DE::EFA is a client for EFA-based itinerary services. fr fr, that's the whole job.
you hand it the start and stop of your journey, maybe a time, maybe a date, maybe a bunch of extra little details, and it hands you back the up-to-date scheduled connections between those two stops. it's giving personal assistant but make it Perl π
under the hood it's using LWP::UserAgent and XML::LibXML to make it all happen.
π METHODS π
$efa = Travel::Routing::DE::EFA->new(%opts)
spawns a brand new Travel::Routing::DE::EFA object and sets up its POST data using %opts. she's born ready β¨
the valid hash keys and their values, let's go:
efa_url => efa_urlβ mandatory, bestie. sets the entry point to the EFA itinerary service. peepefa --listfor a list of supported services. and if you found a URL that isn't listed there? please, please send it to<derf@finalrewind.org>π«Άorigin => [ city, stop [ , type ] ]β mandatory. sets the start of the journey.typeis optional and can be one ofstop(that's the default),address(street and house number, yes really) orpoi(short for "point of interest").destination => [ city, stop [ , type ] ]β mandatory. sets the end of the journey. same deal asorigin, go look up there πvia => [ city, stop [ , type ] ]β optional. names an intermediate stop that the resulting itinerary must contain. arguments work just likeorigin.arrival_time => HH:MMβ journey end time.departure_time => HH:MMβ journey start time. default: now β°date => DD.MM.[YYYY]β journey date. it also accepts the stringtomorrow. default: today πexclude => \@excludeβ do not use certain transport types for the itinerary. accepted arguments:zug,s-bahn,u-bahn,stadtbahn,tram,stadtbus,regionalbus,schnellbus,seilbahn,schiff,ast,sonstige.max_interchanges => numβ set the maximum number of interchanges.num_results => numβ return up tonumconnections. if you leave it unset, the default of the respective EFA server gets used (usually 4 or 5).select_interchange_by => speed|waittime|distanceβ prefer either fast connections (that's the default), connections with low wait time, or connections with little distance to walk.use_near_stops => $intβ if$intis a true value: take stops close to the stop/start into account and possibly use them instead. up to$intminutes of walking are considered acceptable. otherwise: do not take stops close to stop/start into account.train_type => local|ic|iceβ include only local trains into the itinerary (that's the default), all but ICEs, or all. heads up: 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: request connections allowing passengers with bikes π². note that the backend may return an empty result if no such connection exists, or if bike-support simply isn't known.with_low_platform => 0|1β if true: request connections which only use low-platform ("Niederflur") vehicles. note that the backend will return an empty result if no such connection exists.with_wheelchair => 0|1β if true: request connections which are wheelchair-accessible βΏ. again, note that the backend may return an empty result if no such connection exists, or if wheelchair-support isn't known.without_elevators => 0|1β if true: request that transfers do not require usage of elevators.without_escalators => 0|1β if true: request that transfers do not require usage of escalators.without_solid_stairs => 0|1β if true: request that transfers do not require stairs to be taken (i.e. ramps, escalators, elevators or similar must be available).lwp_options => \%hashrefβ options to pass toLWP::UserAgent->new.submit => 0|1β by default,newwill create a POST request and submit it. if you do not want it submitted yet, set this to0.
$efa->submit(%opts)
submits the query to efa_url. %opts gets passed on to LWP::UserAgent->new.
$efa->routes
returns a list of Travel::Routing::DE::EFA::Route(3pm) elements. each one contains one method of getting from start to stop. so many options, so much slay π
π ACCESSORS π
these methods act just like the arguments to new. go see there, bestie.
$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($duration)$efa->walk_speed($speed)$efa->with_bike($bool)
π§ STATIC METHODS π§
Travel::Routing::DE::EFA::get_efa_urls()
returns a list of known EFA entry points. every list element is a hashref with these elements in it:
url: service URL as passed toefa_urlname: Name of the entity operating this serviceshortname: Short name of the entity
π DIAGNOSTICS π
when it hits an error, Travel::Routing::DE::EFA throws a Travel::Routing::DE::EFA::Exception(3pm) object. so catch it, don't just let it sit there in the group chat unanswered π
π DEPENDENCIES π
π BUGS AND LIMITATIONS π
None known. she said flawless and she meant it π (okay but genuinely, that's what the page says β no known bugs.)
π₯ SEE ALSO π₯
Travel::Routing::DE::EFA::Exception(3pm)Travel::Routing::DE::EFA::Route(3pm)WWW::EFAis another implementation, using Moose.
π AUTHOR π
Copyright (C) 2009-2023 by Birte Kristina Friesel <derf@finalrewind.org> π
π LICENSE π
This program is licensed under the same terms as Perl itself.
okay and that's the whole page, bestie π«Ά this one's from the User Contributed Perl Documentation, perl v5.36.0, dated 2023-11-27 β mwah, iconic, periodt β¨π
π¦ where this page comes from
- debian trixie: libtravel-routing-de-vrr-perl 2.24-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libtravel-routing-de-vrr-perl 2.24-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtravel-routing-de-vrr-perl 2.24-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtravel-routing-de-vrr-perl 2.24-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms