NAME

Geo::Coder::GoogleMaps::Response - Response object for the Geo::Coder::GoogleMaps module.

VERSION

Version 0.4 (follow Geo::Coder::GoogleMaps version number)

SYNOPSIS

This module provides a convenient way to represent a response for a geocoding request to Google's servers.

CONSTANTS

Those constants are giving hints about the status of a geocoding request.

G_GEO_SUCCESS: No errors occurred; the address was successfully parsed and its geocode has been returned. 
G_GEO_BAD_REQUEST: A directions request could not be successfully parsed.
G_GEO_SERVER_ERROR: A geocoding, directions or maximum zoom level request could not be successfully processed, yet the exact reason for the failure is not known. 
G_GEO_MISSING_QUERY: The "location" parameter was either missing or had no value.
G_GEO_MISSING_ADDRESS: Synonym for G_GEO_MISSING_QUERY. 
G_GEO_UNKNOWN_ADDRESS: No corresponding geographic location could be found for the specified address.
G_GEO_UNAVAILABLE_ADDRESS: The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons. 
G_GEO_BAD_KEY: The given key is either invalid or does not match the domain for which it was given. 
G_GEO_TOO_MANY_QUERIES: The given key has gone over the requests limit in the 24 hour period or has submitted too many requests in too short a period of time.

FUNCTIONS

new

The object constructor it takes no parameters

is_success

Return true if the the request was successfull and there is actually some placemarks in the list, false otherwise.

If the exact failure reason is needed, please use Geo::Coder::GoogleMaps::Response::status_code() and check with the available constants.

unless( $response->is_success() ){
	print "WARNING: Address is unknown by Google's server !\n" if( $response->status_code() == G_GEO_UNKNOWN_ADDRESS );
}

status_code

Returns the response status code. This code can be tested against the G_GEO_* constants.

if( $response->status_code() == Geo::Coder::GoogleMaps::Response::G_GEO_BAD_KEY )
	print "Please provide a valid Google Maps API key and try again.\n";

status

Returns the complete response status. The status is a hashref which looks like that :

status => {
		code => -1,
		request => ""
	}

add_placemark

Adds the placemark (a Geo::Coder::GoogleMaps::Location object) given in parameter to the list of placemarks.

This methods croak on errors (like if you did not give a proper object in argument).

placemarks

Return the complete list of placemarks, or an arrayref depending on the context.

In any case the array contains a list of Geo::Coder::GoogleMaps::Location objects.

clean_placemarks

Remove all the placemarks from the response object.

clean_status

Reset the response object's status to its initial state (undefined).

AUTHOR

Arnaud Dupuis, <a.dupuis at infinityperl.org>

BUGS

Please report any bugs or feature requests to bug-geo-coder-googlemaps at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Geo-Coder-GoogleMaps. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Geo::Coder::GoogleMaps::Response

You can also look for information at:

ACKNOWLEDGEMENTS

Slaven Rezic (SREZIC) for all the patches and his useful reports on RT.

COPYRIGHT & LICENSE

Copyright 2007-2010 Arnaud DUPUIS, all rights reserved.

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