WWW::Mixi::OO::Page is a WWW::Mixi::OO's Pages base class.
SYNOPSIS
package WWW::Mixi::OO::Foo;
use base qw(WWW::Mixi::OO::Page);
sub uri {
shift->absolute_uri('foo.pl');
}
# some implementations...
METHODS
new
# subclass
sub new {
my $this = shift->SUPER::new(@_);
# some initializations...
}
# call
my $page = $pkg->new($session);
constructor of page. please override if you need some initializations.
uri
# subclass
sub uri {
my ($this, %options) = @_;
$this->SUPER::uri(_path => 'foo',
_params => {
a => b,
},
%options);
}
# call
my $uri = $page->uri([opt => val], ...);
return URI of page.
parse_uri
# subclass
sub parse_uri {
my ($this, $data, %options) = @_;
$this->copy_hash_val($data->{params}, %options, 'page');
if ($data->{path} eq "show_friend") {
# blah...
}
if ($data->{uri}->...) {
# maybe you won't use this
}
$this->SUPER::uri($data, %options);
}
# call
my %options = $page->analyze_uri($uri);
return page information of URI.
parse
# subclass
sub parse {
my ($this, %options) = @_;
# parse...
my $part = $this->parse_extract_parts(qw/.../);
return () unless defined $part;
# return
return ({ a => b, c => d }, { a => e, c => f }, ...);
}
# call
my @datas = $page->parse;
page parser. please return hashref array.
parse_banner
my $data = $page->parse_banner;
parse banner. structure:
link: link to ad page.
subject: subject of ad(banner's alt text).
image: image of banner
height: height of image
width: width of image
parse_mainmenu
my @data = $page->parse_mainmenu;
parse mainmenu. structure:
link: link to page
subject: subject of page
parse_tool_bar
my @data = $page->parse_tool_bar;
parse toolbar. structure:
link: link to page
subject: subject of page
image: image of toolbar.
height: height of image
width: width of image
get
$page->get([opt => val], ...);
handy method. call ->set_content and ->parse.
set_content
$page->set_content($uri);
or
$page->set_content(%options);
set content to specified by uri or options.
Product's homepage
Requirements:
· Perl