The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

hafas - Interface to HAFAS (e.g. Deutsche Bahn) itinerary services

SYNOPSIS

hafas [-d date] [-t time] [-m motlist] [-s service] [-l language] [-v] from [via ...] to

VERSION

version 0.07

DESCRIPTION

hafas is a command line client for HAFAS-based public transit itinerary services, e.g. the one operated by Deutsche Bahn. It requests connections between two stops and prints the results.

OPTIONS

-a, --arriva hh:mm

Request connections that arrive at the destination before hh:mm. Overrides --time / --depart.

-c, --max-change count

Request connections with no more than count changeovers.

-C, --change-time minutes

Request connections with scheduled changeover durations of at least minutes. Note that this does not account for real-time data: the backend may return delayed connections that violate the specified changeover duration.

-d, --date dd.mm.[yyyy]

Planned departure (or arrival) date. Default: today.

-f, --full-route

Show intermediate stops of each connection.

-j, --with-jid

Show journey IDs. These can be used to obtain details on individual journeys via hafas-m.

-l, --language language

Request free-text messages to be provided in language. See --list for a list of languages supported by individual HAFAS instances. Note that requesting an invalid/unsupported language may lead to garbage output.

--list

List known HAFAS installations and exit. Use -s|--service to select an operator from this list for a HAFAS request.

-m, --mot motlist

By default, hafas considers all modes of transport for routing. With motlist, it is possible to either exclude a list of modes, or exclusively show only a select list of modes.

To exclude modes, set motlist to !mot1,!mot2,...

To show them exclusively, set motlist to mot1,mot2,...

The mot types depend on the used service. Use -m help to list them.

-s, --service service

Use the API provided by service for routing; defaults to DB (Deutsche Bahn). See --list for a list of known services.

-t, --time, --depart hh:mm

Request connections that depart from the origin after hh:mm. Default: now.

-v, --verbose

Show more HAFAS messages, e.g. related to construction sites or Wi-Fi availability. Repeating -v increases the verbosity. The level, and thus number of different message types that hafas displays, ranges from 0 (no -v) to 3 (-vvv).

-V, --version

Show version information and exit.

-x, --exclude-infeasible

HAFAS responses include journeys that are infeasible e.g. due to delayed or cancelled trips. By default, hafas displays those with an XX.XX. departure date. When this option is set, hafas silently ignores them instead.

EXIT STATUS

0 upon success, 1 upon internal error, 2 upon backend error.

CONFIGURATION

None.

DEPENDENCIES

  • DateTime(3pm)

  • Encode(3pm)

  • JSON(3pm)

  • List::MoreUtils(3pm)

  • Travel::Routing::DE::HAFAS(3pm)

  • Travel::Status::DE::HAFAS(3pm)

BUGS AND LIMITATIONS

The non-default services (anything other than DB) are not well-tested.

AUTHOR

Copyright (C) 2023 by Birte Kristina Friesel <derf@finalrewind.org>

LICENSE

This program is licensed under the same terms as Perl itself.