NAME

WWW::Mixi::OO::Session - WWW::Mixi::OO's session class

SYNOPSIS

use WWW::Mixi::OO::Session;
my $mixi = WWW::Mixi::OO::Session->new(
    email => 'foo@example.com',
    password => 'password');
$mixi->login;
my @friends = $mixi->page('list_friend')->fetch;
# ...

DESCRIPTION

WWW::Mixi::OO::Session is WWW::Mixi::OO session class.

METHODS

new
my $mixi = WWW::Mixi::OO::Session->new(
    email => $email,
    password => $password,
    encoding => $encoding,
    [rewriter => sub { WWW::Mixi::OO::Util->rewrite(shift); }],
   );

WWW::Mixi::OO constructor.

email

mixi email address.

password

mixi password.

encoding

internal encoding (necessary!)

rewriter

coderef to rewriter, into text

email
$mixi->email('foo@example.com');
my $email = $mixi->email;

set/get mixi email address

password
$mixi->password('foobar');
my $email = $mixi->password;

set/get mixi password

rewriter
$mixi->rewriter->('<foo>bar</foo>');

get/set rewriter (into text).

encoding
$mixi->encoding('euc-jp');

get/set internal encoding.

see also WWW::Mixi::OO::I18N.

response
my $res = $mixi->response;

get last response

content
my $data = $mixi->content;

get last content

cache
# call
my $cache = $mixi->cache(ref($this));
# or in Page subclass
my $cache = $page->cache;

get/set cache

login
$mixi->login

login to mixi.

page
$mixi->page($pagename);

get page(mixi's class)

page_to_class
$mixi->page_to_class($pagename);

get classname from pagename

class_to_page
$mixi->class_to_page($classname);

get pagename from classname

save_cookies
$mixi->save_cookies($file);

save cookies to file

load_cookies
$mixi->load_cookies($file);

load cookies to file

is_logined
croak 'please login!' unless $mixi->is_logined;

return true if logined

is_login_required
croak 'please login before this method' if $mixi->is_login_required;

return true if login required

can_login
  # call (for example only, check_logined method has this code already)
  if ($mixi->is_login_required) {
      if ($mixi->can_login) {
	  $mixi->login;
      } else {
	  croak "Couldn't login to mixi!";
      }
  }

return true if we are able to login to mixi

check_logined
$mixi->check_logined;
$mixi->get(...);

if didn't login, try login or die.

session_id
my $session_id = $mixi->session_id;

return session id

set_content
$mixi->set_content($uri);

set content to specified resource

refresh_content
$mixi->refresh_content;

refresh content

analyze_uri
my @options = $mixi->analyze_uri($uri);

analyze URI and return options.

relative_uri
my $uri = $mixi->relative_uri('http://mixi.jp/login,pl');

generate relative URI from mixi.

absolute_uri
my $uri = $mixi->absolute_uri('login');

generate absolute URI from mixi

absolute_linked_uri
my $uri = $mixi->absolute_linked_uri('foo.pl?bar=baz...');

generate absolute uri from link(or other relative URIs)

post
my $res = $mixi->post('login', foo => bar, baz => qux);

http/post to mixi.

get
my $res = $mixi->get('home');

http/get to mixi.

PROXY METHODS

convert_from_http_content
convert_to_http_content
convert_login_time
convert_time

see WWW::Mixi::OO::I18N.

SEE ALSO

WWW::Mixi::OO, LWP::UserAgent, WWW::Mixi::OO::Util

AUTHOR

Topia <topia@clovery.jp>

COPYRIGHT AND LICENSE

Copyright (C) 2005 by Topia.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.