ikegami > WWW-Kickstarter-v1.2.0 > WWW::Kickstarter::Error

Download:
WWW-Kickstarter-v1.2.0.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

WWW::Kickstarter::Error - Kickstarter error information

SYNOPSIS ^

   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;
   }

DESCRIPTION ^

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.

CONSTRUCTOR ^

new

   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.

If $message is an WWW::Kickstarter::Error object, it is simply returned.

SUBROUTINES ^

my_croak

   my_croak($code, $message);

Creates a WWW::Kickstarter::Error object from the arguments and throws it as an exception.

ACCESSORS ^

code

   my $code = $error->code();

The $code passed to my_croak or the constructor.

One of the following:

message

   my $message = $error->message();

The $message passed to my_croak or the constructor.

as_string

   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.

EXPORTS ^

The following are exported on demand:

VERSION, BUGS, KNOWN ISSUES, SUPPORT, AUTHORS, COPYRIGHT & LICENSE ^

See WWW::Kickstarter

syntax highlighting: