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

NAME

Catalyst::View::REST::Data::Serializer - Data::Serializer View Class

SYNOPSIS

    # lib/MyApp/View/REST.pm
    package MyApp::View::REST;

    use base 'Catalyst::View::REST::Data::Serializer';

    1;

    $c->forward('MyApp::View::REST');

DESCRIPTION

This is the Data::Serializer view class. It can be used to use any number of Serialization methods (YAML, Storable, Data::Dumper) to implement a REST view. It also supports optional compression, encryption, and a host of other useful goodies.

CONFIGURATION OPTIONS

Any of the options you can pass to Data::Serializer you can put into $c->config->{'serializer'}, and have them passed on to it. If you don't pass any options, the following are used:

            serializer       => 'Data::Dumper',
            digester         => 'SHA1',
            cipher           => 'Blowfish',
            secret           => undef,
            portable         => '1',
            compress         => '0',
            serializer_token => '1',
            options          => {},

They are the same as the Data::Serializer defaults. The two additional options are:

astext

Setting this to a true value will allow you to pass the "astext=1" param to any request processed by this View. The results will be the contents of $c->stash passed through to Data::Dumper, as opposed to your Serialized object.

This should be turned off in production environments concerned about security. It's great for debugging, though!

raw

Setting this to a true value will cause Data::Serializer to call the "raw" version of the regular serialize function (raw_serialize). The effect is the same as just using the underlying Serializer directly.

OVERLOADED METHODS

process

Serializes $c->stash to $c->response->output. If you pass "astext=1" as a param, and the $c->config->{'serializer'}->{'astext'} option is true, then it will return the output of the stash via Data::Dumper.

SEE ALSO

Catalyst, Data::Serializer

AUTHOR

Adam Jacob, adam@stalecoffee.org

COPYRIGHT

This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.