~derf / projects / Travel::Status::DE::HAFAS v6.03
dark mode

hafas-m ist ein CLI-Client für HAFAS-basierte Ankunfts-/Abfahrtstafeln. Abhängig von Ort und ausgewähltem HAFAS-Service kann es Fahrten des Regional-/Fernverkehrs oder auch das lokale Nahverkehrsangebot mit Echtzeitdaten anzeigen. Hinweise zur Installation und eine Liste unterstützter Backends finden sich im Travel::Status::DE::DeutscheBahn README.

hafas-m is a comamndline client for HAFAS-based arrival/departure monitors. It shows arrivals or departures of trains as well as local transit services. The level of detail depends on the selected HAFAS service. See the Travel::Status::DE::DeutscheBahn README for installation instructions and supported services.

Abfahrtstafel (departure board)

> hafas-m 'Dortmund Universität'
15:11      Schw-B HB2  Campus Süd, Dortmund
15:13  +1  S 1         Dortmund Hbf                    2
15:15      Schw-B HB1  Technologiezentrum, Dortmund
15:15      Schw-B HB1  Eichlinghofen H-Bahn, Dortmund
15:16      Schw-B HB2  Campus Süd, Dortmund
15:18  +1  S 1         Essen Hbf                       1
15:18      Bus 447     Bandelstraße, Dortmund
15:20      Bus 447     Hacheney, Dortmund

Stationssuche (station search)

> hafas-m '?Universität'
 8006513  Stuttgart Universität
 8000453  Freiburg Messe/Universität
 8004419  Dortmund Universität
 8070769  Bonn Universität/Markt

> hafas-m '51.21277:6.79956'
  0.2 km    366253  Flügelstraße, Düsseldorf
  0.2 km    369007  Kruppstraße, Düsseldorf
  0.2 km    653532  Gangelplatz, Düsseldorf

Zuginfo (train details)

> hafas-m '!ICE 947'
ICE 947 → Berlin Ostbahnhof / Zug 947 / Linie 10
Fahrt 1|177182|0|81|1012024 am 01.01.2024

        19:52           Düsseldorf Hbf → Berlin Ostbahnhof
19:58 → 20:00       ..  Düsseldorf Flughafen
20:08 → 20:10       ..  Duisburg Hbf
20:21 → 20:23       ..  Essen Hbf
20:33 → 20:34       ..  Bochum Hbf
20:45 → 20:48       ..  Dortmund Hbf
21:13 → 21:17 (+6)  .o  Hamm(Westf)Hbf
21:42 → 21:44 (+6)  .o  Bielefeld Hbf
22:32 → 22:34 (+3)  .o  Hannover Hbf
23:05 → 23:06 (+2)  .o  Wolfsburg Hbf
23:34 → 23:36 (+4)  .o  Stendal Hbf
00:11                   Berlin-Spandau
00:27                   Berlin Hbf
00:37                   Berlin Ostbahnhof

Travel-Status-DE-DeutscheBahn-6.02.tar.gz (signature)

  • hafas-m: Add -j / --with-jid option
  • $hafas->station: Correctly determine "name" and "eva" for stations that have multiple EVA IDs and names.

Travel-Status-DE-DeutscheBahn-6.01.tar.gz (signature)

  • Journey: Add operators accessor
  • Add CMTA (Capital Metropolitan Transportation Authority) and BLS (BLS AG) services

Travel-Status-DE-DeutscheBahn-6.00.tar.gz (signature)

  • Add AVV (Aachener Verkehrsverbund), BART (Bay Area Rapid Transit), and IE (Iarnród Éireann / Irish Rail) backends
  • Support backend-specific time zones; add time_zone to service description
  • Handle cross-timezone journeys and stops whose time zone differs from the backend's default time zone. As of this release, all input and output datetimes refer to the backend's default time zone rather than local time (Stop and Journey accessors) / whatever (hafas-m and HAFAS arguments). Use the new tz_offset accessor to determine local time. This is a breaking change.
  • Journey, Stop: Add tz_offset accessor

Travel-Status-DE-DeutscheBahn-5.06.tar.gz (signature)

  • Add Travel::Status::DE::HAFAS::Product module to handle line numbers, operators, and similar. This enables proper support for journeys with multiple operators and possibly multiple train/line numbers along the route. It also exposes the line ID.
  • Journey: Add product accessor
  • Stop: Add prod_arr, prod_dep accessors
  • hafas-m: Improve stop list display in journey mode
  • Fix polyline and platform number support in ÖBB backend (and possibly other non-DB backends)
  • ÖBB backend: correctly handle polylines and platform numbers
  • ÖBB backend: Remove redundant train numbers from $journey->name / $journey->line / $product->name
  • ÖBB backend: update productbits (thanks to Cassidy Dingenskirchen)

Travel-Status-DE-DeutscheBahn-5.05.tar.gz (signature)

  • ÖBB backend: handle midnight crossing and fix associated warnings (patch by Cassidy Dingenskirchen)
  • ÖBB backend: adjust request version to fix backend errors with certain trains (patch by Cassidy Dingenskirchen)

Travel-Status-DE-DeutscheBahn-5.04.tar.gz (signature)

  • Journey: Add is_additional accessor
  • Stop: Add is_additional accessor

Travel-Status-DE-DeutscheBahn-5.03.tar.gz (signature)

  • Journey: Fix route_interesting accessor (broken by 5.00)

Travel-Status-DE-DeutscheBahn-5.02.tar.gz (signature)

  • Fix calls to $journey->route crashing in handle_day_change or add_message in some circumstances if the $hafas object that created $journey has gone out of scope (and become eligible for garbage collection) in the meantime. The culprit was a mis-application of weaken() introduced in v5.01.
  • hafas-m: Add -v/--via option

Travel-Status-DE-DeutscheBahn-5.01.tar.gz (signature)

  • Fix incorrect handling of HIM messages (introduced in 4.19)
  • hafas-m: Declutter station board output: sort by real-time data and show all messages at the end
  • Journey: Support construction from JSON that does not provide a date attribute (i.e., add date parameter to constructor)
  • Stop: Add messages accessor

Travel-Status-DE-DeutscheBahn-5.00.tar.gz (signature)

  • hafas-m: Add --raw-json option (useful for HAFAS client development)
  • hafas-m: Add train search support, e.g. "hafas-m '!EC 6'"
  • HAFAS->new, HAFAS->new_p: Add journeyMatch flag
  • Add Travel::Status::DE::HAFAS::Location module
  • HAFAS::Stop: Fix some documented accessors not being provided by the module
  • HAFAS::Stop: Add "loc" accessor that returns the corresponding Location instance
  • HAFAS::Stop: Breaking change: The "eva", "name", "lat", "lon", "distance_m", and "weight" accessors are no longer supported. Use the (identically named) Location accessors instead, i.e., $stop->loc->name instead of $stop->name, etc.

Travel-Status-DE-DeutscheBahn-4.19.tar.gz (signature)

  • hafas-m: Fall back to locationSearch if StopFinder is unavailable
  • Message: Expose message type; document ->code and ->type accessors

Travel-Status-DE-DeutscheBahn-4.18.tar.gz (signature)

  • Allow HAFAS and hafas-m users to specify the backend language
  • Update services list to include known language specifiers
  • hafas-m: Add -l / --language option
  • HAFAS->new, ->new_p: Add language option

Travel-Status-DE-DeutscheBahn-4.16.tar.gz (signature)

  • Journey: Fix date parser for cross-midnight journeys that start on the 1st through 9th day of a month.

Travel-Status-DE-DeutscheBahn-4.17.tar.gz (signature)

  • Journey: handle empty / undefined nameS fields

Travel-Status-DE-DeutscheBahn-4.14.tar.gz (signature)

  • Journey: Correctly calculate datetimes when requesting a cross-midnight journey after midnight. Previously, those were off by 24 hours.

Travel-Status-DE-DeutscheBahn-4.13.tar.gz (signature)

  • new_p: Return a Travel::Status::DE::HAFAS instance in addition to the error message when rejecting a promise after receiving a HAFAS reply

Travel-Status-DE-DeutscheBahn-4.12.tar.gz (signature)

  • Fix Journey->route and HAFAS geoSearch / locationSearch returning incorrect geocoordinates (latitude and longitude were mixed up)

Travel-Status-DE-DeutscheBahn-4.10.tar.gz (signature)

  • HAFAS->new, ->new_p: Add locationSearch option (search stops by name)
  • Journey->route, ->route_interesting: Return Travel::Status::DE::HAFAS::Stop instances

Travel-Status-DE-DeutscheBahn-4.09.tar.gz (signature)

  • HAFAS->new: Add geoSearch option (search stops by coordinates)

Travel-Status-DE-DeutscheBahn-4.08.tar.gz (signature)

  • Journey: Correctly report route_end / originin arrivals mode
  • Journey->route: Add platform, sched_platform, rt_platform, and is_changed_platform accessors

Travel-Status-DE-DeutscheBahn-4.07.tar.gz (signature)

  • hafas-m: Fix uninitialized value warnings in "--list" output
  • Improve support for non-DB HAFAS instances
  • Fix day change handling in departure board mode. Previously, journeys arriving / departing after midnight had wrong timestamps in some cases.

Travel-Status-DE-DeutscheBahn-4.06.tar.gz (signature)

  • HAFAS->station: rename "uic" to "eva"; add "names" and "evas" keys
  • Rename Journey->station_uic to Journey->station_eva

Travel-Status-DE-DeutscheBahn-4.05.tar.gz (signature)

  • StopFinder: add new_p constructor for async requests via promises

Travel-Status-DE-DeutscheBahn-4.04.tar.gz (signature)

  • Journey->is_cancelled: correctly report cancellations in station board mode

Travel-Status-DE-DeutscheBahn-4.03.tar.gz (signature)

  • HAFAS: Add "station" accessor
  • Journey: Add station, station_uic and line_no accessors
  • Journey->line now returns journey type as well as line number
  • Journey->line_no provides the old Journey->line behaviour
  • Journey: Add route_interesting accessor

Travel-Status-DE-DeutscheBahn-4.02.tar.gz (signature)

  • HAFAS->new: Add "results" and "lookahead" options
  • Build.PL: Specify File::Slurp test dependency

Travel-Status-DE-DeutscheBahn-4.01.tar.gz (signature)

  • Journey: Add "class" accessor
  • Message: Correctly document "short" and "text" accessors ("header" and "lead" were not supported), add is_him accessor
  • Specify List::MoreUtils and List::Util dependencies for bin/hafas-m

Travel-Status-DE-DeutscheBahn-4.00.tar.gz (signature)

  • Use mgate.exe HAFAS interface instead of stboard.exe/bhftafel.exe. This introduces several breaking changes in hafas-m, Travel::Status::DE::HAFAS, and Travel::StatuS::DE::HAFAS::Result.
  • hafas-m: Options -l/--lang, -L/--ignore-late, and -u/--url are no longer supported
  • hafas-m now supports journey details by specifying a journey ID instead of a station name.
  • Travel::Status::DE::HAFAS->new: date and time keys are no longer supported. Use datetime instead.
  • Travel::Status::DE::HAFAS->new: lang key is no longer supported.
  • Travel::Status::DE::HAFAS->new: url key is no longer supported.
  • Travel::Status::DE::HAFAS->new: mode key is no longer supported. Set arrivals to a true value to request arrivals instead of departures.
  • Travel::Status::DE::HAFAS->new: add optional cache key and support for journey requests with optional with_polyline key.
  • Travel::Status::DE::HAFAS: add new_p constructor for async requests via Promises.
  • Travel::Status::DE::HAFAS: Add result and messages accessors.
  • Rename Travel::Status::DE::HAFAS::Result to ...::Journey. The accessors sched_date, date, info, countdown, countdown_sec, raw_e_delay, raw_delay, sched_time, time, train, train_no and line_no are no longer supported. Introduces several new ones instead.
  • The module no longer depends on XML::LibXML
  • New dependency: Digest::MD5

Travel-Status-DE-DeutscheBahn-3.01.tar.gz (signature)

  • Fix support for ÖBB and other backends which recently switched from two- to four-digit years

Travel-Status-DE-DeutscheBahn-3.00.tar.gz (signature)

  • Result: The date, datetime, and time accessors now report realtime data if available
  • Result: Add sched_date, sched_datetime, and sched_time accessors for schedule data

Travel-Status-DE-DeutscheBahn-2.05.tar.gz (signature)

  • Document LWP::Protocol::https dependency
  • Remove BVG (Berliner Verkehrsgesellschaft) and SBB (Schweizerische Bundesbahnen) services

Travel-Status-DE-DeutscheBahn-2.04.tar.gz (signature)

  • Handle invalid XML when using the VBB backend

Travel-Status-DE-DeutscheBahn-2.02.tar.gz (signature)

  • New dependencies: DateTime and DateTime::Format::Strptime
  • Result: New accessors ->datetime, ->countdown and ->countdown_sec

Travel-Status-DE-DeutscheBahn-2.01.tar.gz (signature)

  • Result: Fix ->type accessor (was not working for all backends)
  • Result: Add ->train_no / ->line_no accessor

Travel-Status-DE-DeutscheBahn-2.00.tar.gz (signature)

  • This release is NOT backwards compatible with 1.xx versions
  • It now uses the HAFAS API instead of parsing bahn.de/ris and also supports various other HAFAS installations
  • New module dependencies: JSON, List::MoreUtils
  • Renamed db-ris to hafas-m
  • New modules: Travel::Status::DE::HAFAS and Travel::Status::DE::HAFAS::StopFinder
  • Renamed Travel::Status::DE::DeutscheBahn::Resultto Travel::Status::DE::HAFAS::Result
  • db-ris/hafas-m: The options -f / --full-route and -v/--via are no longer supported
  • db-ris/hafas-m: New options -s / --service, -u / --url and --list
  • Travel::Status::DE::DeutscheBahn/HAFAS->new: The mot parameter is no longer supported. Use the new excluded_mots and exclusive_mots parameters instead
  • Travel::Status::DE::DeutscheBahn/HAFAS->new: Add service and url parameters
  • Travel::Status::DE::DeutscheBahn/HAFAS: Add errcode, similar_stops and get_active_service accessors
  • Travel::Status::DE::DeutscheBahn/HAFAS: Add static methods get_services and get_service
  • Result: Remove route, route_raw, route_info, route_interesting and route_timetable accessors
  • Result: Add is_changed_platform and messages accessors
  • Result->info is now undef instead of an empty string when no information is available

Travel-Status-DE-DeutscheBahn-1.05.tar.gz (signature)

  • Result->route_interesting: Also consider airports
  • Result: Add route_info accessor
  • Result: Add is_cancelled accessor

Travel-Status-DE-DeutscheBahn-1.04.tar.gz (signature)

  • Result: Add type accessor
  • DeutscheBahn->new: Add lwp_options parameter to pass options to LWP::UserAgent->new

Travel-Status-DE-DeutscheBahn-1.03.tar.gz (signature)

  • Add primitive JSON serializer to Travel::Status::DE::DeutscheBahn::Result
  • Fix $result->delay (was broken by changes in the RIS output format)

Travel-Status-DE-DeutscheBahn-1.02.tar.gz (signature)

  • Respect proxy environment variables
  • Add -a / --arrivals option to show arrivals instead of departures
  • Disable smartmatch warnings on perl ≥ 5.018

Travel-Status-DE-DeutscheBahn-1.01.tar.gz (signature)

  • Detect ambiguous input errors (available via errstr)
  • Add language switch for additional information (german/english)


  • Result: Add line (== train) and date accessors


  • Add -l / --lang option

Travel-Status-DE-DeutscheBahn-1.00.tar.gz (signature)


  • Add --full-route option


  • Fix bug when receiving no platform numbers from the DB RIS


  • Add route_timetable accessor containing station names and their corresponding arrival times

Travel-Status-DE-DeutscheBahn-0.05.tar.gz (signature)

  • Fix ->results returning duplicate connections when accessed more than one time
  • new: Only die when encountering wrong options, set ->errstr otherwise
  • Adds new ->errstr accessor to check for request errors

Travel-Status-DE-DeutscheBahn-0.04.tar.gz (signature)


  • The info accessor now strips the mostly useless "k.A." / "pünktlich" (train on time) text parts
  • Add (slightly experimental) route_interesting accessor
  • Add delay accessor

Travel-Status-DE-DeutscheBahn-0.03.tar.gz (signature)

  • Clarify derl dependency (we actually need >= 5.10.1)
  • Strip leading / trailing whitespace in result fields

Travel-Status-DE-DeutscheBahn-0.02.tar.gz (sig)


  • Only display info when a train is late, not when on time / unknown
  • Add --ignore-late option


  • Add route_raw accessor
  • Proper HTTP request error handling
  • Strip leading whitespace from ::Result info
  • Do not include canceled stops in the route

Travel-Status-DE-DeutscheBahn-0.01.tar.gz (signature)

  • Initial release
  • Crawls almost all data available in the web interface