WWW::xkcd is a Perl module that allows you to access xkcd comics using the official API in synchronous mode (what people are used to) or in asynchronous mode.
The asynchronous mode requires you have AnyEvent and AnyEvent::HTTP available. However, since it's just supported and not crucial, it is not declared as a prerequisite.
Currently it retrieves the metadata of each comic, but it will probalby also fetch the actual comic in the next release.
This module still hasn't materialized so some things might change, but probably not a lot, if at all.
SYNOPSIS
use WWW::xkcd;
my $xkcd = WWW::xkcd->new;
my $comic = $xkcd->fetch; # provides latest data
say "Today's comic is titled: ", $comic->{'title'};
# or in async mode
$xkcd->fetch( sub {
my $comic = shift;
say "Today's comic is titled: ", $comic->{'title'};
} );
Product's homepage
Requirements:
· Perl