NAME
WebService::KVV::Live::Stop - Arrival times for Trams/Buses in the
Karlsruhe metropolitan area
SYNOPSIS
use WebService::KVV::Live::Stop;
use utf8;
use open qw( :encoding(UTF-8) :std );
my $stop = WebService::KVV::Live::Stop->new("Siemensallee");
print "Arrival time: $_->{time} $_->{route} $_->{destination}\n" for $stop->departures;
Print departure table:
use WebService::KVV::Live::Stop;
use utf8;
use open qw( :encoding(UTF-8) :std );
use Data::Dumper::Table;
use Data::Visitor::Callback;
$stop = WebService::KVV::Live::Stop->new($ARGV[0] // 'Kronenplatz');
my @entries = $stop->departures;
Data::Visitor::Callback->new('JSON::PP::Boolean' => sub { $_ = $_ ? 'true' : 0 })->visit(@entries);
my $departure_table = Tabulate \@entries;
$departure_table =~ s/^.*\n//; # remove object type
print $departure_tabletable;
DESCRIPTION
API for searching for bus/tram stops in the Karlsruhe Metropolitan Area
(Karlsruhe Verkehrsvertriebe network to be exact) and for listing
departure times at said stops.
IMPLEMENTATION
Not really an API, just a client for
http://live.kvv.de. See
kvvlive.json
<
https://github.com/athreef/WebService-KVV-Live-Stop/blob/master/share/kvvlive.json>
for details.
The client is based on Net::HTTP::Spore and has some workarounds: It
overrides a method from Net::HTTP::Spore that doesn't handle colons
properly and throws a generic message on errors instead of the more
specific HTTP error messages.
METHODS AND ARGUMENTS
new($latitude, $langitude), new($name), new($id)
Search for matching local transport stops. $id are identifiers
starting with "de:". $name need not be an exact match.
Returns a list of WebService::KVV::Live::Stops in list context. In
scalar context returns the best match.
departures([$route])
Returns a list of departures for a WebService::KVV::Live::Stop.
Results can be restricted to a particular route (Linie) by the
optional argument.
GIT REPOSITORY
http://github.com/athreef/WebService-KVV-Live-Stop
SEE ALSO
http://live.kvv.de
AUTHOR
Ahmad Fatoum <
[email protected]>,
http://a3f.at
COPYRIGHT AND LICENSE
Copyright (C) 2016 Ahmad Fatoum
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.