[Catalyst-commits] r7345 - in
Catalyst-Action-REST/0.60/trunk/t/lib/Test/Serialize: . Controller
jshirley at dev.catalyst.perl.org
jshirley at dev.catalyst.perl.org
Thu Jan 3 23:22:16 GMT 2008
Author: jshirley
Date: 2008-01-03 23:22:16 +0000 (Thu, 03 Jan 2008)
New Revision: 7345
Added:
Catalyst-Action-REST/0.60/trunk/t/lib/Test/Serialize/Controller/
Catalyst-Action-REST/0.60/trunk/t/lib/Test/Serialize/Controller/REST.pm
Log:
Hey, how about I actually add in my test controller class?
Added: Catalyst-Action-REST/0.60/trunk/t/lib/Test/Serialize/Controller/REST.pm
===================================================================
--- Catalyst-Action-REST/0.60/trunk/t/lib/Test/Serialize/Controller/REST.pm (rev 0)
+++ Catalyst-Action-REST/0.60/trunk/t/lib/Test/Serialize/Controller/REST.pm 2008-01-03 23:22:16 UTC (rev 7345)
@@ -0,0 +1,46 @@
+package Test::Serialize::Controller::REST;
+
+use warnings;
+use strict;
+
+use base qw/Catalyst::Controller::REST/;
+
+__PACKAGE__->config(
+ 'namespace' => '',
+ 'stash_key' => 'rest',
+ 'map' => {
+ 'text/html' => 'YAML::HTML',
+ 'text/xml' => 'XML::Simple',
+ 'text/x-yaml' => 'YAML',
+ 'text/x-json' => 'JSON',
+ 'text/x-data-dumper' => [ 'Data::Serializer', 'Data::Dumper' ],
+ 'text/x-data-denter' => [ 'Data::Serializer', 'Data::Denter' ],
+ 'text/x-data-taxi' => [ 'Data::Serializer', 'Data::Taxi' ],
+ 'application/x-storable' => [ 'Data::Serializer', 'Storable' ],
+ 'application/x-freezethaw' =>
+ [ 'Data::Serializer', 'FreezeThaw' ],
+ 'text/x-config-general' =>
+ [ 'Data::Serializer', 'Config::General' ],
+ 'text/x-php-serialization' =>
+ [ 'Data::Serializer', 'PHP::Serialization' ],
+ 'text/view' => [ 'View', 'Simple' ],
+ 'text/broken' => 'Broken',
+ },
+);
+
+sub monkey_put : Local : ActionClass('Deserialize') {
+ my ( $self, $c ) = @_;
+ if ( ref($c->req->data) eq "HASH" ) {
+ $c->res->output( $c->req->data->{'sushi'} );
+ } else {
+ $c->res->output(1);
+ }
+}
+
+sub monkey_get : Local : ActionClass('Serialize') {
+ my ( $self, $c ) = @_;
+ $c->stash->{'rest'} = { monkey => 'likes chicken!', };
+}
+
+1;
+
More information about the Catalyst-commits
mailing list