NAME

WWW::Velib::Map Process the Velib' map information

VERSION

This document describes version 0.02 of WWW::Velib::Map, released 2007-11-13.

SYNOPSIS

use WWW::Velib::Map;

DESCRIPTION

METHODS

new

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.

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

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.

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:

  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.

station

Returns a reference to a hash of all the stations in the map, keyed by station number.

AUTHOR

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?

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.