WWW::Velib::Map Process the Velib' map information
This document describes version 0.02 of WWW::Velib::Map, released 2007-11-13.
use WWW::Velib::Map;
Download a the Velib' map information from the web. The information may be cached locally (see the save method). A previously saved map file may be loaded by specifying it with the file attribute.
save
file
my $map = WWW::Velib::Map->new; # download from the web my $m2 = WWW::Velib::Map->new(file => 'map.data'); # use local file
In the latter example, the method will croak if the file does not exist or cannot be decoded.
Save the downloaded map information into a local file. The method will croak if the file cannot be written.
$map->save('map.data');
Search the station list for the stations that match some criteria. Returns an array of WWW::Velib::Station objects.
WWW::Velib::Station
Currently, one may search for stations near a given station, limited by either number or distance (in metres). The stations may be queried for current details (availabale bikes and slots).
Search by distance (returns all the stations within n metres):
my @station = $m->search( station => 1234, distance => 600 );
To obtain the status of each station, use the status attribute:
status
my @station = $m->search( station => 2345, distance => 500, status => 1, );
Search by number (returns the n closest stations):
my @station = $m->search( station => 1234, n => 4 );
Nota bene: the official map contains many errors. Alternate maps of better quality exist and will be used in a future version.
Returns a reference to a hash of all the stations in the map, keyed by station number.
David Landgren, copyright (C) 2007. All rights reserved.
http://www.landgren.net/perl/
If you (find a) use this module, I'd love to hear about it. If you want to be informed of updates, send me a note. You know my first name, you know my domain. Can you guess my e-mail address?
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install WWW::Velib, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Velib
CPAN shell
perl -MCPAN -e shell install WWW::Velib
For more information on module installation, please visit the detailed CPAN module installation guide.