---
name: "Travel::Routing::DE::EFA"
section: "3pm"
platform: "linux"
package: "libtravel-routing-de-vrr-perl"
version: "2.24-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Travel::Routing::DE::EFA"
---

# Travel::Routing::DE::EFA(3pm)

unofficial interface to EFA-based itinerary services

## NAME

Travel::Routing::DE::EFA - unofficial interface to EFA-based itinerary services

## 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";
        }
```

## VERSION

version 2.24

## DESCRIPTION

**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.

## METHODS

- $efa = Travel::Routing::DE::EFA-\>new(*%opts*)

  Returns a new Travel::Routing::DE::EFA object and sets up its POST data via `%opts`.

  Valid hash keys and their values are:

  - **efa\_url** =\> *efa\_url*

    Mandatory.  Sets the entry point to the EFA itinerary service. See `"efa --list"` for a list of supported services.

    If you found a URL not listed there, please send it to \<derf@finalrewind.org\>.

  - **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.  Also accepts the string **tomorrow**.  Default: today

  - **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

  - **num\_results** =\> *num*

    Return up to *num* connections.  If unset, the default of the respective EFA server is used (usually 4 or 5).

  - **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** =\> *$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 itinerary (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: Request connections allowing passengers with bikes. Note that the backed may return an empty result if no such connection exists or 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 backed 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 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 to be submitted yet, set this to **0**.

- $efa-\>submit(*%opts*)

  Submit the query to *efa\_url*. *%opts* is passed on to `"LWP::UserAgent->new"`.

- $efa-\>routes

  Returns a list of [**Travel::Routing::DE::EFA::Route**(3pm)](/Travel::Routing::DE::EFA::Route/3pm.md) 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(*$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. Each list element is a hashref with the following elements.

  - **url**: service URL as passed to **efa\_url**

    - **name**: Name of the entity operating this service

    - **shortname**: Short name of the entity

    ## DIAGNOSTICS

When encountering an error, Travel::Routing::DE::EFA throws a [**Travel::Routing::DE::EFA::Exception**(3pm)](/Travel::Routing::DE::EFA::Exception/3pm.md) object.

## DEPENDENCIES

- •

  [**LWP::UserAgent**(3pm)](/LWP::UserAgent/3pm.md)

- •

  [**XML::LibXML**(3pm)](/XML::LibXML/3pm.md)

## BUGS AND LIMITATIONS

None known.

## SEE ALSO

- •

  [**Travel::Routing::DE::EFA::Exception**(3pm)](/Travel::Routing::DE::EFA::Exception/3pm.md)

- •

  [**Travel::Routing::DE::EFA::Route**(3pm)](/Travel::Routing::DE::EFA::Route/3pm.md)

- •

  WWW::EFA is 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.
