Travel...E::EFA(3pm)

πŸ“¦
version 2.24 Β· 3 versions
, in debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ 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. peep efa --list for 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. type is optional and can be one of stop (that's the default), address (street and house number, yes really) or poi (short for "point of interest").
  • destination => [ city, stop [ , type ] ] β€” mandatory. sets the end of the journey. same deal as origin, go look up there πŸ‘†
  • via => [ city, stop [ , type ] ] β€” optional. names an intermediate stop that the resulting itinerary must contain. arguments work just like origin.
  • 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 string tomorrow. 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 to num connections. 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 $int is a true value: take stops close to the stop/start into account and possibly use them instead. up to $int minutes 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 to LWP::UserAgent->new.
  • submit => 0|1 β€” by default, new will create a POST request and submit it. if you do not want it submitted yet, set this to 0.

$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 to efa_url
  • name: Name of the entity operating this service
  • shortname: 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 πŸ”₯


🌟 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