WWW::DoingItWrongCom::RandImage - fetch random image from http://www.doingitwrong.com
use strict; use warnings; use WWW::DoingItWrongCom::RandImage; my $wrong = WWW::DoingItWrongCom::RandImage->new; my $wrong_pic = $wrong->fetch or die "Failed to get the picture: " . $wrong->err_msg; print "You are doing it wrong: $wrong_pic\n";
The module is basic and simple. All it does is access http://www.doingitwrong.com and return a URI to a random image.
my $wrong = WWW::DoingItWrongCom::RandImage->new; my $wrong = WWW::DoingItWrongCom::RandImage->new( ua_args => { timeout => 20, agent => 'WrongAgent', }, );
The new() method returns a WWW::DoingItWrongCom::RandImage object. It takes one optional argument:
new()
my $wrong = WWW::DoingItWrongCom::RandImage->new( ua_args => { timeout => 20, agent => 'WrongAgent', }, );
Optional. The ua_args argument takes a hashref as a value which will be passed to LWP::UserAgent object constructor. See LWP::UseAgent documentation for possible keys/values. By default the default LWP::UserAgent's constructor will be used except for timeout which, unless specified by you, will default to 30 seconds.
ua_args
timeout
30
my $wrong_pic = $wrong->fetch or die "Failed to get the picture: " . $wrong->err_msg;
The fetch() method instructs WWW::DoingItWrongCom::RandImage to fetch a random image from http://www.doingitwrong.com and returns a URI object (which is overloaded, thus can be treated as a string) which will point to the random image from http://www.doingitwrong.com. If an error occured during the process, fetch() will return undef and the error explanation will be accessible via err_msg() method (see below).
fetch()
undef
err_msg()
If an error occured during the fetching of the URI of the image, the fetch() method will return undef. The explanation of the error will be avalable via err_msg() method.
For healthy operation module requires the following modules/versions:
'Carp' => 1.04, 'URI' => 1.35, 'LWP::UserAgent' => 2.036, 'HTML::TokeParser::Simple' => 3.15,
It might work well with earlier versions of the above modules, but it wasn't tested with those.
Zoffix Znet, <zoffix at cpan.org>
<zoffix at cpan.org>
Please report any bugs or feature requests to bug-www-doingitwrongcom-randimage at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-DoingItWrongCom-RandImage. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-www-doingitwrongcom-randimage at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc WWW::DoingItWrongCom::RandImage
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=WWW-DoingItWrongCom-RandImage
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/WWW-DoingItWrongCom-RandImage
CPAN Ratings
http://cpanratings.perl.org/d/WWW-DoingItWrongCom-RandImage
Search CPAN
http://search.cpan.org/dist/WWW-DoingItWrongCom-RandImage
Copyright 2008 Zoffix Znet, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install WWW::DoingItWrongCom::RandImage, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::DoingItWrongCom::RandImage
CPAN shell
perl -MCPAN -e shell install WWW::DoingItWrongCom::RandImage
For more information on module installation, please visit the detailed CPAN module installation guide.