NAME

HTTP::MobileAgent::Plugin::Location - Add location fuctions to HTTP::MobileAgent

VERSION

This document describes HTTP::MobileAgent::Plugin::Location version 0.0.3

SYNOPSIS

use HTTP::MobileAgent::Plugin::Location;

my $ma = HTTP::MobileAgent->new;

# Add query request object (L<CGI>,L<Apache::Request>,L<Catalyst::Request>...)
# If not added, B<H::MA> make L<CGI> object automatically.

$ma->query($q);


# If you want to get location html description, you do as below

my $uri  = "http://example.com/location/callback?param1=a&param2=b"; # String or URI object
my $desc = "Push this button to get location!";                      # Description on location link
my $opt  = {                                                         # All optional
  method => "get",    # "a", "post" or "get". default is different by carrer and generation.
  mode   => "sector", # "gps", "sector" or "area". default is most precise mode of terminal.
  html   => "xhtml",  # "chtml" or "xhtml". xhtml compliant terminal's default is xhtml, other is chtml.
};

my $desc = $ma->location_description($uri,$desc,$opt) or warn $ma->err;

# Returns L<HTTP::MobileAgent::Plugin::Location::HTMLElement> object, or undef if error occurs.
# L<HTTP::MobileAgent::Plugin::Location::HTMLElement> is subclass of L<HTML::Element>, 
# and see more detail in it's pod.
# If undef returns, you can check the reason by B<err> method.


# If you want to parse lat-long location from query, you do as below

$ma->parse_location;

# After do that, you can get L<HTTP::MobileAgent::Plugin::Location::LocationObject::LG> object by
# B<location> property.
# L<HTTP::MobileAgent::Plugin::Location::LocationObject::LG> is subclass of L<Location::GeoTool>,
# and see mode detail in L<HTTP::MobileAgent::Plugin::Location::LocationObject>'s pod.

my $loc = $ma->location;
warn $ma->err if (!$loc && $ma->err);

# B<location> property return undef if location information is not included in query or location information
# is invalid.
# If undef returns, check B<err> method.
# If B<err> is undef, query not include location information.

# You can use L<Geo::Coordinates::Converter> instead of L<Location::GeoTool> as lat-long location obect.
# If you want to do so, check L<HTTP::MobileAgent::Plugin::Location::LocationObject::GCC>.


# If you want to parse not only lat-long object but i-Area object, you import this module as

use HTTP::MobileAgent::Plugin::Location qw(use_area);

# Or, if you want to parse i-Area arbeitery, set B<use_area> property to true.

$ma->use_area(1);

# After doing above and calling B<parse_location> method, you can get
# L<HTTP::MobileAgent::Plugin::Location::AreaObject> by B<area> property.

$ma->parse_location;
my $area = $ma->area;

# L<HTTP::MobileAgent::Plugin::Location::AreaObject> is subclass of L<Location::Area::DoCoMo::iArea>,
# and see mode detail in L<HTTP::MobileAgent::Plugin::Location::AreaObject>'s pod.

DEPENDENCIES

HTTP::MobileAgent::Plugin::XHTML
CGI
Class::Data::Inheritable
Class::Accessor::Fast
URI
URI::QueryParam
URI::Escape
HTTP::MobileAgent::Plugin::Location::Support
HTTP::MobileAgent::Plugin::Location::LocationObject
HTTP::MobileAgent::Plugin::Location::AreaObject
HTTP::MobileAgent::Plugin::Location::HTMLElement

BUGS AND LIMITATIONS

No bugs have been reported.

Please report any bugs or feature requests to nene@kokogiko.net.

AUTHOR

OHTSUKA Ko-hei <nene@kokogiko.net>

LICENCE AND COPYRIGHT

Copyright (c) 2007, OHTSUKA Ko-hei <nene@kokogiko.net>. All rights reserved.

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

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.