1 package Test::Serialize::Controller::REST;
3 use namespace::autoclean;
6 BEGIN { extends qw/Catalyst::Controller::REST/ };
10 'stash_key' => 'rest',
12 'text/x-data-dumper' => [ 'Data::Serializer', 'Data::Dumper' ],
13 'text/x-data-denter' => [ 'Data::Serializer', 'Data::Denter' ],
14 'text/x-data-taxi' => [ 'Data::Serializer', 'Data::Taxi' ],
15 'application/x-storable' => [ 'Data::Serializer', 'Storable' ],
16 'application/x-freezethaw' =>
17 [ 'Data::Serializer', 'FreezeThaw' ],
18 'text/x-config-general' =>
19 [ 'Data::Serializer', 'Config::General' ],
20 'text/x-php-serialization' =>
21 [ 'Data::Serializer', 'PHP::Serialization' ],
25 sub monkey_put : Local : ActionClass('Deserialize') {
26 my ( $self, $c ) = @_;
27 if ( ref($c->req->data) eq "HASH" ) {
28 my $out = ($c->req->data->{'sushi'}||'') . ($c->req->data->{'chicken'}||'');
30 $c->res->output( $out );
36 sub monkey_get : Local : ActionClass('Serialize') {
37 my ( $self, $c ) = @_;
38 $c->stash->{'rest'} = { monkey => 'likes chicken!', };
41 sub xss_get : Local : ActionClass('Serialize') {
42 my ( $self, $c ) = @_;
43 $c->stash->{'rest'} = { monkey => 'likes chicken > sushi!', };