WWW::Kickstarter::Error - Kickstarter error information
use WWW::Kickstarter; my $email = '...'; # Your Kickstarter login credentials my $password = '...'; my $ks = WWW::Kickstarter->new(); $ks->login($email, $password); my $exists = 1; if (!eval { $ks->user($user_id); 1 }) { my $e = WWW::Kickster::Error->new($@); die $e if $e->code != 404; $exists = 0; }
By throwing objects of this class rather than a string, the caller can identify certain errors programatically without relying on matching the exact text of the message.
my $error = WWW::Kickstarter::Error->new($code, $message); my $error = WWW::Kickstarter::Error->new($message);
Creates an WWW::Kickstarter::Error object from the specified $code and $message. See code for acceptable values for $code.
$code
$message
code
If $message is an WWW::Kickstarter::Error object, it is simply returned.
my_croak($code, $message);
Creates a WWW::Kickstarter::Error object from the arguments and throws it as an exception.
my $code = $error->code();
The $code passed to my_croak or the constructor.
my_croak
One of the following:
400 to 499
400
499
Invalid arguments provided.
401
Authentication failure. The user does not exist, or an incorrect password was supplied.
404
The specified user, project or category does not exist.
500 to 599
500
599
A communication error or an unrecognized response.
my $message = $error->message();
The $message passed to my_croak or the constructor.
my $message = $error->as_string(); my $message = "$error";
An error message complete with the file name and line number of the call into the WWW::Kickstarter library.
The following are exported on demand:
See WWW::Kickstarter
To install WWW::Kickstarter, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Kickstarter
CPAN shell
perl -MCPAN -e shell install WWW::Kickstarter
For more information on module installation, please visit the detailed CPAN module installation guide.