=head1 NAME Warabe::App::Role::MessagePack - Warabe Web Application API - MessagePack module =head1 SYNOPSIS package My::Warabe::App; use base qw(Warabe::App::Role::MessagePack Warabe::App); $app = My::Warabe::App->new_from_http ($http); print Dumper $app->mp_param ('mpdata'); =head1 DESCRIPTION The C module defines additional methods for handling MessagePack data in L API. This module is intended to be used a superclass of some subclass of L. =head1 METHODS =over 4 =item $data = $app->mp_param ($name) Decode the request parameter (i.e. C or C encoded form data set in query parameters and request-body) with the specified name as MessagePack and return as a Perl scalar value. If the parameter values is not a MessagePack serialized data, the C value is returned. Please note that, since MessagePack does not have character string type (which is different from byte (or octet) string type), any string extracted from the MessagePack data will not have utf8 flag set. Also note that the percent-encoded data must be a MessagePack encoded byte stream. This is a willful violation to the HTML Living Standard, which defines the C data model in terms of characters rather than bytes. =item $data = $app->mpb64_param ($name) Decode the request parameter (i.e. C or C encoded form data set in query parameters and request-body) with the specified name as MessagePack data encoded in "base64url" and return as a Perl scalar value. If the parameter values is not a MessagePack serialized data encoded in the base64url format, the C value is returned. =item $app->send_mp ($data) Send the given data, encoded in MessagePack format, as the response-body. The data must be a value that can be encoded into MessagePack. The C header is set to C. =back =head1 SEE ALSO L. MessagePack . base64url . L. =head1 AUTHOR Wakaba . =head1 LICENSE Copyright 2012 Wakaba . This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut