NAME
Comics::Fetcher::Single -- Cascading url grabber
SYNOPSIS
package Comics::Plugin::Sigmund;
use parent qw(Comics::Fetcher::Cascade);
sub register {
shift->SUPER::register
( { name => "Sigmund",
url => "http://www.sigmund.nl/",
pats => [ 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 arguments:
- 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), pat
(single fetch), or pats
(cascading fetch).
- path
-
The URL of the desired image.
If path is not an absolute URL, it will be interpreted relative to the url.
- pat
-
A pattern to locate the image URL from the starting page.
- pats
-
An array ref 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.
The final pattern may additionally define:
- title
-
The image title.
- alt
-
The alternative text.