WWW::GoKGS::Scraper - Abstract base class for KGS scrapers
use parent 'WWW::GoKGS::Scraper'; use WWW::GoKGS::Scraper::Declare; sub base_uri { 'http://www.gokgs.com/...' } sub __build_scraper { my $self = shift; scraper { ... }; }
This module is an abstract base class for KGS scrapers. KGS scrapers must inherit from this class, and also implement the following methods:
Must return a URI string which represents a resource on KGS. This method is called as a method on the class.
Must return an Web::Scraper object which can scrape the resource. This method is called as a method on the object.
scrape
Given key-value pairs of query parameters, constructs a URI object which consists of base_uri and the paramters.
base_uri
Can be used to get or set an LWP::UserAgent object which is used to GET the requested resource. Defaults to the LWP::UserAgent object shared by Web::Scraper users ($Web::Scraper::UserAgent).
GET
LWP::UserAgent
$Web::Scraper::UserAgent
Given arguments are passed to the scrape method of an Web::Scraper object built by the __build_scraper method.
__build_scraper
Given key-value pairs of query parameters, constructs a URI object which consists of base_uri and the parameters, then pass the URI to the scrape method.
URI
Can be used to get or set a class name which is used to build_tree. Defaults to HTML::TreeBuilder::XPath. You shouldn't modify this attribute unless you understand what you're doing.
build_tree
use HTML::TreeBuilder::LibXML; $scraper->_tree_builder_class( 'HTML::TreeBuilder::LibXML' );
WWW::GoKGS
Ryo Anazawa (anazawa@cpan.org)
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
To install WWW::GoKGS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::GoKGS
CPAN shell
perl -MCPAN -e shell install WWW::GoKGS
For more information on module installation, please visit the detailed CPAN module installation guide.