NAME

Travel::Status::DE::DeutscheBahn - Interface to the DeutscheBahn online arrival/departure monitor

SYNOPSIS

use Travel::Status::DE::DeutscheBahn;

my $status = Travel::Status::DE::DeutscheBahn->new(
	station => 'Essen Hbf',
);

for my $departure ($status->results) {
	printf(
		"At %s: %s to %s from platform %s\n",
		$departure->time,
		$departure->train,
		$departure->destination,
		$departure->platform,
	);
}

VERSION

version 0.02

DESCRIPTION

Travel::Status::DE::DeutscheBahn is an interface to the DeutscheBahn arrival/departure monitor available at http://reiseauskunft.bahn.de/bin/bhftafel.exe/dn.

It takes a station name and (optional) date and time and reports all arrivals or departures at that station starting at the specified point in time (now if unspecified).

METHODS

my $status = Travel::Status::DE::DeutscheBahn->new(%opts)

Returns a new Travel::Status::DE::DeutscheBahn element. Supported opts are:

station => station

The train station to report for, e.g. "Essen HBf". Mandatory.

date => dd.mm.yyyy

Date to report for. Defaults to the current day.

time => hh:mm

Time to report for. Defaults to now.

mode => arr|dep

By default, Travel::Status::DE::DeutscheBahn reports train departures (dep). Set this to arr to get arrivals instead.

mot => \%hashref

Modes of transport to show. Accepted keys are: ice (ICE trains), ic_ec (IC and EC trains), d (InterRegio and similarly fast trains), nv ("Nahverkehr", mostly RegionalExpress trains), s ("S-Bahn"), bus, ferry, u ("U-Bahn") and tram.

Setting a mode (as hash key) to 1 includes it, 0 excludes it. undef leaves it at the default.

By default, the following are shown: ice, ic_ec, d, nv, s.

$status->results()

Returns a list of arrivals/departures. Each list element is a Travel::Status::DE::DeutscheBahn::Result(3pm) object.

DIAGNOSTICS

None.

DEPENDENCIES

  • Class::Accessor(3pm)

  • LWP::UserAgent(3pm)

  • XML::LibXML(3pm)

BUGS AND LIMITATIONS

In the web interface, a train's route contains station names and the corresponding arrival times. These times are not yet accessible.

SEE ALSO

Travel::Status::DE::DeutscheBahn::Result(3pm).

AUTHOR

Copyright (C) 2011 by Daniel Friesel <derf@finalrewind.org>

LICENSE

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