WWW::JSON::Response - Response objects returned by WWW::JSON requests
use WWW::JSON; my $wj = WWW::JSON->new( base_url => 'http://api.metacpan.org/v0?fields=name,distribution&size=1', post_body_format => 'JSON', default_response_transform => sub { shift->{hits}{hits}[0]{fields} }, ); my $get = $wj->get( '/release/_search', { q => 'author:ANTIPASTA', filter => 'status:latest', } ); if ($get->success) { say $r->res->{distribution}; } else { say $r->error; }
WWW::JSON::Response objects return data from WWW::JSON requests.
An HTTP::Response object containing json
True if both the http request returned successfully (HTTP 200 OK) AND the json was successfully decoded. False if either of those things went horribly wrong.
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.
Alias for response
HTTP code returned by this request
HTTP status_line code returned by this request
The HTTP response's non json-decoded content
The url of this request
The HTTP::Response object corresponding to the request
Copyright (C) Joe Papperello.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Joe Papperello <antipasta@cpan.org>
To install WWW::JSON, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::JSON
CPAN shell
perl -MCPAN -e shell install WWW::JSON
For more information on module installation, please visit the detailed CPAN module installation guide.