|
NAMEWWW::Comic - Retrieve comic strip imagesSYNOPSISuse strict; use WWW::Comic qw(); # Create a WWW::Comic object my $wc = new WWW::Comic; # Get a list of supported comics my @comics = $wc->comics; # Allow HTTP requests to retrieve a full list of supported # comics if necessary (some plugins may not know what comics # they support until they make an HTTP request) my @comics = $wc->comics(probe => 1); for my $comic (@comics) { # Get the most recent comic strip URL for $comic my $url = $comic->strip_url(comic => $comic); # Download the most recent comic strip # for $comic in to $blob my $blob = $comic->get_strip(comic => $comic); # Write the most recent comic strip for # $comic to disk my $filename = $comic->mirror_strip(comic => $comic); } DESCRIPTIONThis module will download cartoon comic strip images from various websites and return a binary blob of the image, or write it to disk. Multiple comic strips can be supported through subclassed plugin modules.A number of plugin modules are bundled as part of this distrubution. You may want to refer to their documentation for any additional custom methods and features. Specifically, WWW::Comic::Plugin::UFS and WWW::Comic::Plugin::uComics require use of the "probe" paramater with the "comics" method on order to retrieve a list of supported commics. To find out what plugin modules you currently have installed and available, run the following: perl -MWWW::Comic -MData::Dumper -e"print Dumper([WWW::Comic->new->plugins]);" METHODSnewmy $wc = new WWW::Comic; Creates a new WWW::Comic object. comicsmy @comics = $wc->comics(probe => 1); Returns a list of available comics. The "probe" paramater is optional. (See below).
strip_url# Get the URL of the most recent "mycomic" comic image my $url = $wc->strip_url(comic => "mycomic"); # Get the URl of a specific "mycomic" comic image my $specificStripUrl = $wc->strip_url( comic => "mycomic", id => 990317 ); Returns the URL of a comic strip. The "comic" paramater is mandatory and must be a valid supported comic as listed by the "comics()" method. The most recent comic strip image URL will be returned unless otherwise specified (see the "id" paramater below). This method will return an "undef" value upon failure. The "id" paramater is optional and can be used to specify a specific comic (if supported by the plugin in question). Comic IDs are typically date based in some way, but this is unique to each comic and follows no special format for the purposes of this module. See each plugin module's documentation for further information.
get_strip# Retrieve the most recent "mycomic" comic strip image my $imageBlob = $wc->get_strip(comic => "mycomic"); # Retrieve a specific "mycomic" comic strip image my $image2 = $wc->get_strip( comic => "mycomic", id => "0042304973" ); Downloads a copy of a comic strip image and returns the binary data as a scalar. The "comic" paramater is mandatory and must be a valid supported comic as listed by the "comics()" method. The most recent comic strip image will be returned unless otherwise specified. This method will return an "undef" value upon failure.
mirror_strip# Write the most recent "mycomic" comic strip to disk # and return the name of the file that was written my $filename = $wc->mirror_strip(comic => "mycomic"); # Write the "mycomic" comic strip image (reference 132) # to disk, specifcally to mycomic.gif, and return the # actual filename that was written to disk in to $file2 my $file2 = $wc->mirror_strip( comic => "mycomic", id => "132", filename => "mycomic.gif" ); Download a copy of a comic strip image and write it to disk, returning the name of the file that was actually written. This method accepts the same paramaters as the "get_strip()" method, with the addition of the "filename" paramater. This method will return an "undef" value upon failure.
pluginsmy @plugins = $wc->plugins; Return a list of loaded plugins. PLUGINSSupport for different comics is handled through the WWW::Comic::Plugin superclass. See the POD for WWW::Comic::Plugin on how to create a new plugin.SEE ALSOWWW::Comic::Plugin, WWW::Dilbert, WWW::VenusEnvyVERSION$Id: Comic.pm,v 1.5 2006/01/10 15:45:44 nicolaw Exp $AUTHORNicola Worthington <nicolaw@cpan.org><http://perlgirl.org.uk> COPYRIGHTCopyright 2006 Nicola Worthington.This software is licensed under The Apache Software License, Version 2.0. <http://www.apache.org/licenses/LICENSE-2.0>
Visit the GSP FreeBSD Man Page Interface. |