GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Net::HTTP::Spore::Middleware::Format(3) User Contributed Perl Documentation Net::HTTP::Spore::Middleware::Format(3)

Net::HTTP::Spore::Middleware::Format - base class for formats middlewares

version 0.09

    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).

serializer_key
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
deserializer_key
as previously, but for the response instead of the request
encode
this method MUST be implemented in class extending this one. This method MUST return an encoded string from the argument passed.
decode
this method MUST be implemented in class extending this one. This method MUST return a reference from the undecoded string passed as argument.
accept_type
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.
content_type
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.
should_serialize
this method returns 1 if serialization have not already been done
should_deserialize
this method returns 1 if deserialization have not already been done
call

  • Franck Cuny <franck.cuny@gmail.com>
  • Ash Berlin <ash@cpan.org>
  • Ahmad Fatoum <athreef@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.

2017-10-27 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.