NAME

WWW::JSON::Response - Response objects returned by WWW::JSON requests

SYNOPSIS

use WWW::JSON;

my $wj = WWW::JSON->new(
    base_url    => 'https://graph.facebook.com',
    base_params => { access_token => 'XXXXX' }
);
my $r = $wj->get('/me', { fields => 'email' } );
if ($r->success) {
    print $r->res->{email} . "\n";
} else {
    print "HTTP ERROR CODE " . $r->code . "\n";
    print "HTTP STATUS " . $r->status_line . "\n";
}

DESCRIPTION

WWW::JSON::Response objects return data from WWW::JSON requests.

PARAMETERS

http_response

An HTTP::Response object containing json

METHODS

success

1 if both the http request returned successfully (HTTP 200 OK) AND the json was successfully decoded. 0 if either of those things went badly.

response

The results of decoding the json response. Will be decoded even in the event of an error, since hopefully the API is nice enough to return some json describing the error that occurred.

res

Alias for response

code

HTTP code returned by this request

status_line

HTTP status_line code returned by this request

content

The HTTP response's non json-decoded content

url

The url of this request

http_response

The HTTP::Response object corresponding to the request

LICENSE

Copyright (C) Joe Papperello.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Joe Papperello <antipasta@cpan.org>