The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::Gnats::Response - A Gnats payload class.

DESCRIPTION

For dealing with raw responses and error codes returned by Gnatsd. Enables an easier payload method.

VERSION

0.15

SYNOPSIS

  use Net::Gnats::Reponse;

  # Compose payload via constructor
  my $response = Net::Gnats::Response->new({ raw => $data,
                                             code => $code});

  # Compose disparately
  my $response = Net::Gnats::Response->new;
  $response->raw($data);
  $response->code($code);

CONSTRUCTORS

There are two types of constructors available.

The first enables a 'shell' response which carries children responses. The shell response does not require initialization data.

The second enables the capturing a full response. When initializing the response, the code and raw data must be passed to initialization.

new

Constructor for the shell Response object.

 my $r = new(code => $code, raw => $raw)

ACCESSORS

The following public accessors are available. All accessors are readonly because the response class expects the raw data to be submitted during instantiation.

raw

The readonly raw accessor retrieves raw result data for this particular response. If this is a parent response for a single payload, then it will return an empty anonymous array.

 my $r = Net::Gnats::Response( code => $code, raw => $raw );

code

The readonly code accessor for the result code.

 my $r = Net::Gnats::Response( code => $code, raw => $raw );
 return 1 if $r->code == Net::Gnats::CODE_OK;

inner_responses

The readonly accessor for fetching child responses.

is_finished

The response has completed processing. Returns 1 if processing has completed, returns 0 otherwise.

status

Retrieve the overall status of the response. If this response, or all child responses, resulted positively then returns 1. Otherwise, it returns 0.

METHODS

as_list

Assumes the Gnatsd payload response is a 'list' and parses it as so.

Returns: Anonymous array of list items from this response and all children.

as_string

INCOMPATIBILITIES

None.

SUBROUTINES/METHODS

BUGS AND LIMITATIONS

None.

CONFIGURATION AND ENVIRONMENT

None.

DEPENDENCIES

None.

DIAGNOSTICS

None.

AUTHOR

Richard Elberger, riche@cpan.org

LICENSE AND COPYRIGHT

License: GPL V3

(c) 2014 Richard Elberger

3 POD Errors

The following errors were encountered while parsing the POD:

Around line 184:

=begin without a target?

Around line 186:

'=item' outside of any '=over'

Around line 304:

You forgot a '=back' before '=head1'