NAME
Comics::Fetcher::Single -- Simple url grabber
SYNOPSIS
package Comics::Plugin::Sigmund;
use parent qw(Comics::Fetcher::Single);
sub register {
shift->SUPER::register
( { name => "Sigmund",
url => "http://www.sigmund.nl/",
pat =>
qr{ <img \s+
src="?(?<url>strips/(?<image>sig.+\.\w+))"? \s+
width="\d+" \s+
height="\d+" \s+
border="\d+" \s* >
}x,
} );
}
# Return the package name.
__PACKAGE__;
DESCRIPTION
The Single
Fetcher requires registration of a pattern pat that is used to determine the URL of the desired image from the contents of the comic's home page.
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 home page.
Fetcher specific arguments:
- pat
-
The pattern to locate the image URL. It should be as flexible as possible, while still guaranteed to extract the correct image URL.
When the pattern matches, it must define at least the following named captures:
- url
-
The (relative) url of the image.
If the URL is not an absolute URL, it will be interpreted relative to the url argument.
- image
-
The image name within the url.
- title
-
Optional. The image title.
- alt
-
Optional. The alternative text.