interfaces to xkcd comics
$WWW::xkcd::VERSION = '0.009';
use strict;
use warnings;
use Carp;
use JSON::MaybeXS;
use HTTP::Tiny;
my $can_async = eval { require AnyEvent; require AnyEvent::HTTP; 1 };
shift;
my %args = (
'baseurl' => 'https://xkcd.com',
'infopath' => 'info.0.json',
@_,
);
return bless { %args }, $class;
}
sub fetch_metadata {
my $self
::HTTP::http_get( $url, sub {
my $body = shift;
my $meta = $self->_decode_json($body);
return $cb->($meta);
} );
return 0;
}
# this is sy