OHTSUKA Ko-hei > WWW-Hatena-WanWanWorld > WWW::Hatena::Scraper

Download:
WWW-Hatena-WanWanWorld-0.02.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Module Version: 0.01   Source  

NAME ^

WWW::Hatena::Scraper - Base class to scraping Hatena/Hatelabo Web sites

SYNOPSIS ^

    use WWW::Hatena::Scraper;

    ## Simple use for.
    my $whs = WWW::Hatena::Scraper->new;
    my $username = $whs->login('username','password') or die "Login failed!";
    my $content = $whs->get_content("http://www.hatena.ne.jp/");

    ## You can get login cookie and re-login later.
    my $rk = $whs->rk;

    my $whs2 = WWW::Hatena::Scraper->new;
    my $username = $whs2->login($rk) or die "Cookie is invalid or expired!";

    ## If you want to access Hatelabo, do like this:
    my $labo = WWW::Hatena::Scraper->new(labo => 1);
    my $username = $labo->login('username','password') or die "Login failed!";
    my $content = $labo->get_content("http://www.hatelabo.jp/");

    ## Logout.
    $whs->logout;
    $whs2->logout;
    $labo->logout;

DESCRIPTION ^

WWW::Hatena::Scraper is a client for fetching Hatena and Hatelabo's logined pages.

CONSTRUCTOR ^

new

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

You can set the ua and labo option in constructor.

ua

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

labo

If you set this option 1, login to not Hatena(hatena.ne.jp) but Hatelabo (hatelabo.jp).

METHODS ^

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

Login to Hatena/Hatelabo web sites. Return value is Hatena user id, and if undef returns, login failed.

$whs->get_content($url,[ $content ])

Fetch $url's web content. $url must be the page of Hatena/Hatelabo. $content is optional, if given, use POST method, or use GET method.

$whs->logout

Logout from Hatena/Hatelabo web sites.

$whs->user

Returns user id if login successed.

$whs->rk

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

$whs->err

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

$whs->errcode

Returns the last error code.

$whs->errtext

Returns the last error text.

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 website: http://hatena.ne.jp/ Hatelabo website: http://hatelabo.jp/

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

AUTHORS ^

OHTSUKA Ko-hei <nene@kokogiko.net>