NAME

WWW::Hatena::WanWanWorld - Client class to access Hatena Wan Wan World

SYNOPSIS

    use WWW::Hatena::WanWanWorld;

    ## Login
    my $www = WWW::Hatena::WanWanWorld->new;
    my $username = $www->login('username','password') or die "Login failed!";

    ## Prepare
    $www->position(35.657540,139.702341);
    $www->voice('BowWow!!');

    ## To set own position and voice, and get around users in 2km.
    my $arounds = $www->get_around(2);

    ## To get own friend.
    my $friends = $www->get_friend;

    ## To get markers (house, or so) in 2km around.
    my $markers = $www->get_marker(2);

    ## To add other user to own friend.
    $www->add_friend("otheruser");

    ## To add other user to own friend.
    $www->delete_friend("otheruser");

    ## To put own house here.
    $www->add_house;

    ## Logout.
    $www->logout;

DESCRIPTION

WWW::Hatena::WanWanWorld is a client to operate your own dog in Hatena Wan Wan World from perl.

CONSTRUCTOR

new

my $www = WWW::Hatena::Scraper->new([ %opts ]);

You can set the ua and charset option in constructor.

ua

If you want to reuse LWP::UserAgent object, set it to this option.

ua

You MUST set this option if you want to use multi-byte string as binary data. (Even if you use UTF-8!) With this, you specify the character code using in script. If you use this module under "use utf8;" or "use encoding foobar;" environment, you MUST NOT set this value.

METHODS

$www->login($userid,$password)
$www->login($cookie)

Login to Hatena Wan Wan World. Return value is Hatena user id, and if undef returns, login failed.

$www->logout

Logout from Hatena Wan Wan World.

$www->user

Returns user id if login successed.

$www->rk

Returns login cookie if login successed. Give this value to login method later, you can relogin, unless it hasn't expired.

$www->position($latitude,$longitude)
$www->position

Set or get user's(dog's?) position in latitude,longitude array.

$www->lat($latitude)
$www->lat

Set or get latitude of user's(dog's?) position.

$www->long($longitude)
$www->long

Set or get longitude of user's(dog's?) position.

$www->voice($voice)
$www->voice

Set or get user's(dog's?) voice to show.

$www->get_around($km)

Send position and voice data to Hatena Wan Wan World's server. Return object is, other user's list of around $km kilo meters. Object is just raw hash-ref translated from JSON response. If $km value is too big, (maybe $km > 9), server returns no value. This may specification of Hatena Wan Wan World.

$www->arounds

Return same object of get_around method returns. You can get it later by this method.

$www->get_friend

Return object is, friend's list of user. Object is just raw array-ref translated from JSON response.

$www->friends

Return same object of get_friend method returns. You can get it later by this method.

$www->get_marker($km)

Return object is, marker (house, or so) list of around $km kilo meters. Object is just raw hash-ref translated from JSON response.

$www->markers

Return same object of get_marker method returns. You can get it later by this method.

$www->add_friend($username)

Add other user to user's friend. Return 1 if succesed, 0 if failed.

$www->delete_friend($username)

Delete other user to user's friend. Return 1 if succesed, 0 if failed.

$www->add_house

Build user's own house at user's position.

$www->err

Returns the last error, in form "errcode: errtext"

$www->errcode

Returns the last error code.

$www->errtext

Returns the last error text.

NOTICE

From 0.02, charcode setting is not optional, and change from method to constructor option. You MUST or MUST NOT set this option, decides whether you use multibyte character as binary (Legacy way) or string (After perl 5.8, under use utf8; or use encoding;).
Area detectation(calcurating minimum and maximum longitude/latitude) logic of get_around method and get_marker method is just poor hacked. It is only work around in Japan, typically not worked near the pole.
All raw objects translated from JSON has mistakes. In these object, attribute lat means longitude, lng means latitude. This is error of Hatena itself. Take care. In perl API, there are no such mistakes.

TODO

Make user-friendry class to handle objects translated from JSON.

COPYRIGHT

This module is Copyright (c) 2006 OHTSUKA Ko-hei. All rights reserved.

You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file. If you need more liberal licensing terms, please contact the maintainer.

WARRANTY

This is free software. IT COMES WITHOUT WARRANTY OF ANY KIND.

SEE ALSO

Hatena Wan Wan World website: http://world.hatelabo.jp/

WWW::Hatena::Scraper -- part of this module

AUTHORS

OHTSUKA Ko-hei <nene@kokogiko.net>

3 POD Errors

The following errors were encountered while parsing the POD:

Around line 225:

'=item' outside of any '=over'

Around line 333:

'=item' outside of any '=over'

Around line 348:

You forgot a '=back' before '=head1'