Travel::Status::DE::HAFAS::StopFinder - Interface to HAFAS-based online stop finder services
use Travel::Status::DE::HAFAS::StopFinder; my $sf = Travel::Status::DE::HAFAS::StopFinder->new( url => 'http://reiseauskunft.bahn.de/bin/ajax-getstop.exe', input => 'Borbeck', ); if (my $err = $sf->errstr) { die("Request error: ${err}\n"); } for my $candidate ($sf->results) { printf("%s (%s)\n", $candidate->{name}, $candidate->{id}); }
version 2.01
Travel::Status::DE::HAFAS::StopFinder is an interface to the stop finder service of HAFAS based arrival/departure monitors, for instance the one available at http://reiseauskunft.bahn.de/bin/ajax-getstop.exe/dn.
It takes a string (usually a location or station name) and reports all stations and stops which are lexically similar to it.
Looks up stops as specified by opts and teruns a new Travel::Status::DE::HAFAS::StopFinder element with the results. Dies if the wrong opts were passed.
Supported opts are:
string to look up, e.g. "Borbeck" or "Koeln Bonn Flughafen". Mandatory.
Base url of the stop finder service, without the language and mode suffix ("/dn" and similar). Mandatory. See Travel::Status::DE::HAFAS(3pm)'s get_services method for a list of URLs.
Set language. Accepted arguments are deutsch, english, italian and n (dutch), depending on the used service.
It is unknown if this option has any effect.
Passed on to LWP::UserAgent->new. Defaults to { timeout => 10 }, you can use an empty hashref to override it.
LWP::UserAgent->new
{ timeout => 10 }
In case of an error in the HTTP request, returns a string describing it. If no error occurred, returns undef.
Returns a list of stop candidates. Each list element is a hash reference. The hash keys are id (IBNR / UIC station code) and name (stop name). Both can be used as input for the Travel::Status::DE::HAFAS(3pm) constructor.
If no matching results were found or the parser / http request failed, returns the empty list.
None.
LWP::UserAgent(3pm)
JSON(3pm)
Unknown.
Travel::Status::DE::HAFAS(3pm).
Copyright (C) 2015 by Daniel Friesel <derf@finalrewind.org>
This module is licensed under the same terms as Perl itself.
To install Travel::Status::DE::DeutscheBahn, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Travel::Status::DE::DeutscheBahn
CPAN shell
perl -MCPAN -e shell install Travel::Status::DE::DeutscheBahn
For more information on module installation, please visit the detailed CPAN module installation guide.