Author image Johan Vromans
and 1 contributors

NAME

Comics::Fetcher::Cascade -- Cascading url grabber

SYNOPSIS

  package Comics::Plugin::Sigmund;
  use parent qw(Comics::Fetcher::Cascade);

  our $name    = "Sigmund";
  our $url     = "http://www.sigmund.nl/";
  our @patterns = ( [ qr{ ... (?<url>...) ... },
                      qr{ ... (?<url>...) ... },
                      ...
                      qr{ ... (?<url>...) ... } ],
                  );

  # Return the package name.
  __PACKAGE__;

DESCRIPTION

The Cascading Fetcher can use one or more patterns to determine the URL of the desired image. If multiple patterns are supplied, each pattern is applied to the fetched page and must define the url for the next page as a named capture. The process is repeated, and the final pattern has to provide the final url and image name.

The Fetcher requires the common package variables:

$name

The full name of this comic, e.g. "Fokke en Sukke".

$url

The url of this comic's starting (i.e. home) page.

Fetcher specific arguments:

This Fetcher requires either $path (direct URL fetch), $pattern (single fetch), or @patterns (cascading fetch).

$path

The URL of the desired image.

If path is not an absolute URL, it will be interpreted relative to the url.

$pattern

A pattern to locate the image URL from the starting page.

@patterns

An array with patterns to locate the image URL.

When a pattern matches, it must define the named capture url, which points to the page to be loaded and used for the next pattern.

Any of the patterns may additionally define:

title

The image title.

alt

The alternative text.