The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

WWW::GoKGS::Scraper - Abstract base class for scrapers

SYNOPSIS

  use parent 'WWW::GoKGS::Scraper';
  use URI;
  use Web::Scraper;

  sub _build_base_uri {
      URI->new('http://www.gokgs.com/...');
  }

  sub _build_scraper {
      my $self = shift;

      scraper {
          ...
      };
  }

DESCRIPTION

This class is an abstract base class for KGS scrapers. KGS scrapers must inherit from this class, and also implement two methods; _build_base_uri and _build_scraper. _build_base_uri must return a URI object which represents a resource on KGS. _build_scraper must return an Web::Scraper object which is used to parse the resource.

ATTRIBUTES

$URI = $scraper->base_uri

Returns a URI object which represents a resource on KGS. This attribute is read-only.

$UserAgent = $scraper->user_agent
$scraper->user_agent( LWP::UserAgent->new(...) )

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).

METHODS

$scraper->scrape
$scraper->query

SEE ALSO

WWW::GoKGS

AUTHOR

Ryo Anazawa (anazawa@cpan.org)

LICENSE

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.