Subject: | Module breaks walking directions |
Hi,
I have found your module helpful, but it causes problems when I use
"type foot" with the get_route() method.
The attached test case demonstrates this problem. To run the test, set
the CLOUDMADE_API_KEY environment variable to the value of an API key.
I believe this problem occurs because you set "method" to "shortest" in
your "get_route" subroutine, but Cloudmade's documentation states that
you can only use this value for car journeys.
Also the get_route() returns a Geo::Cloudmade::Route object but you do
not document this object anywhere. I had to read the module's code to
understand how to use it.
I hope you can fix this interesting module so it works for people who
don't travel by car.
Thanks,
Tom
Subject: | walking-route.t |
#!perl
use strict;
use warnings;
use Geo::Cloudmade ();
use Test::More;
if ($ENV{CLOUDMADE_API_KEY}) {
my $geo = Geo::Cloudmade->new($ENV{CLOUDMADE_API_KEY});
isa_ok $geo, 'Geo::Cloudmade';
my $route;
eval {
$route = $geo->get_route(
[qw(51.51103 -0.1122)],
[qw(51.51666 -0.1125)],
{ type => 'foot' },
);
};
ok ! $@, 'Route generation did not die';
if (exists $route->{status_message}) {
unlike $route->{status_message}, qr/wrong route type/i, 'No error message';
}
}
done_testing;