Net::HTTP::Spore::Middleware::Format - base class for formats middlewares
version 0.06
my $client = Net::HTTP::Spore->new_from_spec('twitter.json'); $client->enable('Format::JSON'); my $res = $client->public_timeline(); # $res->body contains an hashref build from the JSON returned by the API
This middleware is a base class for others format's middleware. Thoses middlewares must set the appropriate Content-Type and Accept header to the request.
If the environment contains a payload (under the name 'spore.payload'), it should also serialize this data to the appropriate format (eg: if payload contains an hashref, and the format is json, the hashref MUST be serialized to JSON).
name of the extension serializer should check to be sure to not encode a payload already encoded, or set the headers that have already been defined
as previously, but for the response instead of the request
this method MUST be implemented in class extending this one. This method MUST return an encoded string from the argument passed.
this method MUST be implemented in class extending this one. This method MUST return a reference from the undecoded string passed as argument.
this method MUST be implemented in class extending this one. This method MUST return a string that will be used as the Accept HTTP header.
this method MUST be implemented in class extending this one. This method MUST return a string that will be used as the Content-Type HTTP header.
this method returns 1 if serialization have not already been done
this method returns 1 if deserialization have not already been done
franck cuny <franck@lumberjaph.net>
Ash Berlin <ash@cpan.org>
This software is copyright (c) 2012 by linkfluence.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Net::HTTP::Spore, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::HTTP::Spore
CPAN shell
perl -MCPAN -e shell install Net::HTTP::Spore
For more information on module installation, please visit the detailed CPAN module installation guide.