The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Clustericious::Plugin::DataHandler -- Handle data types automatically

SYNOPSIS

DESCRIPTION

Adds a renderer that automatically serializes that "autodata" in the stash into a format based on HTTP Accept and Content-Type headers. Also adds a helper called 'parse_autodata' that handles incoming data by Content-Type.

Supports application/json, text/x-yaml and application/x-www-form-urlencoded (in-bound only).

When parse_autodata is called from within a route like this:

    $self->parse_autodata;

POSTed data is parsed according to the type in the 'Content-Type' header with the data left in stash->{autodata}. It is also returned by the above call.

If a route leaves data in stash->{autodata}, it is rendered by this handler, which chooses the type with the first acceptable type listed in the Accept header, the Content-Type header, or the default. (By default, the default is application/json, but you can override that too).

TODO

more documentation

handle XML with schemas

handle RDF with templates

Should I make this a 'helper' instead of a 'hook'? Or just a normal function?