Comics::Fetcher::Cascade -- Cascading url grabber
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__;
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.
Cascading
The Fetcher requires the common package variables:
The full name of this comic, e.g. "Fokke en Sukke".
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
$pattern
@patterns
The URL of the desired image.
If path is not an absolute URL, it will be interpreted relative to the url.
A pattern to locate the image URL from the starting page.
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.
url
Any of the patterns may additionally define:
The image title.
The alternative text.
To install Comics, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Comics
CPAN shell
perl -MCPAN -e shell install Comics
For more information on module installation, please visit the detailed CPAN module installation guide.