Test::WWW::Mechanize::JSON - add a JSON method to the super-class
use Test::More 'no_plan'; use_ok("Test::WWW::Mechanize::JSON") or BAIL_OUT; my $MECH = Test::WWW::Mechanize::JSON->new( noproxy => 1, etc => 'other-params-for-Test::WWW::Mechanize', ); $MECH->get('http://example.com/json'); my $json_as_perl = $MECH->json_ok or BAIL_OUT Dumper $MECH->response; $MECH->diag_json;
Extends Test::WWW::Mechanize to test the JSON script and JSON output.
Tests that the last received resopnse body is valid JSON.
A default description of "Got JSON from $url" or "Not JSON from $url" is used if none if provided.
Returns the JSON object, that you may perform further tests upon it.
As $mech-json_ok($desc)> but examines the x-json header.
$mech-
x-json
Like diag, but renders the JSON of the last request with indentation.
Passes if the last response contained a charset=utf-8 definition in its content-type header.
charset=utf-8
Copyright (C) Lee Goddard, 2009/2011.
Available under the same terms as Perl itself.
To install Test::WWW::Mechanize::JSON, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::WWW::Mechanize::JSON
CPAN shell
perl -MCPAN -e shell install Test::WWW::Mechanize::JSON
For more information on module installation, please visit the detailed CPAN module installation guide.