NAME
WebService::Gyazo - perl image upload library for gyazo.com
SYNOPSIS
use WebService::Gyazo;
my $newUserId = time();
my $upAgent = WebService::Gyazo->new(id => $newUserId);
print "Set user id [".$newUserId."]\n";
my $image = $upAgent->uploadFile('1.jpg');
unless ($upAgent->isError) {
print "Image uploaded [".$image->getImageUrl()."]\n";
} else {
print "Error:\n".$upAgent->error()."\n\n";
}
DESCRIPTION
WebService::Gyazo helps you to upload images to gyazo.com (via regular expressions and LWP).
METHODS
new
my $userID = time();
my $wsd = WebService::Gyazo->new(id => $userID);
Constructs a new WebService::Gyazo
object. Parameter id is optional, if the parameter is not passed, it will take the value of the time() function.
setProxy
my $proxy = 'http://1.2.3.4:8080';
if ($wsd->setProxy($proxy)) {
print "Proxy [".$proxy."] seted!";
} else {
print "Proxy not seted! Error [".$wsd->error."]";
}
Set proxy 1.2.3.4:8080
and protocol http for LWP::UserAgent
object.
error
print "Error [".$wsd->error."]" if ($wsd->isError);
This method return text of last error.
isError
print "Error [".$wsd->error."]" if ($wsd->isError);
This method return 1 if $wsd->{error} not undef, else return 0.
setId
my $newUserId = time();
if ($wsd->setId($newUserId)) {
print "User id [".$newUserId."] seted!";
} else {
print "User id not seted! Error [".$wsd->error."]";
}
This method set new gyazo user id.
uploadFile
my $result = $upAgent->uploadFile('1.jpg');
if (defined($result) and !$upAgent->isError) {
print "Returned result[".$result->getImageUrl()."]\n";
} else {
print "Error:\n".$upAgent->error()."\n\n";
}
This metod return object WebService::Gyazo::Image.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc WebService::Gyazo
SEE ALSO
WebService::Gyazo::Image, LWP::UserAgent.
AUTHOR
SHok, <shok at cpan.org> (http://nig.org.ua/)
COPYRIGHT
Copyright 2013-2014 by SHok
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.