PX::API::Response::JSON - A C<PX::API::Response> plugin.


PX-API documentation Contained in the PX-API distribution.

Index


Code Index:

NAME

Top

PX::API::Response::JSON - A PX::API::Response plugin.

DESCRIPTION

Top

This plugin is loaded automagically by PX::API::Response when the 'json' response format is returned from the Peekshows API. JSON is used to parse the json object returned from the API call.

DEPENDENCIES

Top

JSON

SEE ALSO

Top

PX::API http://www.peekshows.com http://services.peekshows.com

AUTHOR

Top

Anthony Decena <anthony@1bci.com>

LICENCE AND COPYRIGHT

Top


PX-API documentation Contained in the PX-API distribution.

package PX::API::Response::JSON;
use warnings;
use strict;
use Carp;

use version; our $VERSION = qv('0.0.3');

use JSON;

sub new {
	my $class = shift;
	my $args  = shift;

	$class = ref($class) || $class;
	my $self = bless {}, $class;

	$self->{'xs'} = JSON->new();
	return $self;
	}

sub parse {
	my $self = shift;
	my $json = shift;

	my $xs = $self->{'xs'};
	my $ref = $xs->jsonToObj($json);
	return $ref;
	}

sub format { 'json' }


1;
__END__