NAME

Net::Mailboxlayer::Error - Encapsulates an error response from mailboxlayer.com's REST API.

SYNOPSIS

 use Net::Mailboxlayer;

 my $mailboxlayer = Net::Mailboxlayer->new(access_key => 'YOUR_ACCESS_KEY', email_address => 'support@apilayer.com');
 my $result = $mailboxlayer->check;

 if ($result->has_error)
 {
   # $result is a F<Net::Mailboxlayer::Error> object.
   print "There was an error: ". $result->info . "\n";
 }

DESCRIPTION

You would not normally be calling this module directly, it is one of the possible return objects from a call to Net::Mailboxlayer's check method.

The errors provided are developer oriented, you probably don't want to pass them onto your users.

For API errors, see the official docs (https://mailboxlayer.com/documentation) for more information.

It is also possible that the errors are generated from $user_agent->get(), so you may also want to see the HTTP::Response documentation.

new

Returns a new Net::Mailboxlayer::Error object.

has_error

This is a convenience method that allows you to determine if the result object had an error or not. For this module if will always be 1 (true).

success

This is always set to 0 for the Net::Mailboxlayer::Error object, but it is not available in the Net::Mailboxlayer::Response object. has_error is the preferred way to check for success.

 print $response->success; # 0

type

An internal error type.

info

A short text description of the error which may contain suggestions.

code

The numeric code of the API Error. In addition to the API errors, you can also get errors from your useragent

response

Provides access to the return value of $user_agent->get(). In typical usage, this would be a HTTP::Response object. You do not normally need to access this.

 print $result->response->decoded_content; # prints the JSON return from the api call.

AUTHOR

Tom Heady <cpan@punch.net>

COPYRIGHT & LICENSE

Copyright 2016 Tom Heady.

This program is free software; you can redistribute it and/or modify it under the terms of either:

  • the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or

  • the Artistic License.