Cherry pick everything bar the use parent change from 25d49c2, fixing RT#46680
Tomas Doran [Fri, 11 Dec 2009 09:50:05 +0000 (09:50 +0000)]
17 files changed:
lib/Catalyst/Action/Deserialize.pm
lib/Catalyst/Action/Deserialize/Data/Serializer.pm
lib/Catalyst/Action/Deserialize/JSON.pm
lib/Catalyst/Action/Deserialize/XML/Simple.pm
lib/Catalyst/Action/Deserialize/YAML.pm
lib/Catalyst/Action/REST.pm
lib/Catalyst/Action/Serialize.pm
lib/Catalyst/Action/Serialize/Data/Serializer.pm
lib/Catalyst/Action/Serialize/JSON.pm
lib/Catalyst/Action/Serialize/XML/Simple.pm
lib/Catalyst/Action/Serialize/YAML.pm
lib/Catalyst/Action/Serialize/YAML/HTML.pm
lib/Catalyst/Action/SerializeBase.pm
lib/Catalyst/Controller/REST.pm
lib/Catalyst/Request/REST.pm
t/lib/Test/Rest.pm
t/lib/Test/Serialize.pm

index d6568ae..744a02d 100644 (file)
@@ -1,9 +1,3 @@
-#
-# Catlyst::Action::Deserialize
-# Created by: Adam Jacob, Marchex, <adam@hjksolutions.com>
-#
-# $Id$
-
 package Catalyst::Action::Deserialize;
 
 use strict;
index cbe1236..911fb31 100644 (file)
@@ -1,10 +1,3 @@
-#
-# Catalyst::Action::Deserialize::Data::Serializer.pm
-# Created by: Adam Jacob, Marchex, <adam@hjksolutions.com>
-# Created on: 10/12/2006 03:00:32 PM PDT
-#
-# $Id$
-
 package Catalyst::Action::Deserialize::Data::Serializer;
 
 use strict;
index f4bf2e4..01059aa 100644 (file)
@@ -1,10 +1,3 @@
-#
-# Catlyst::Action::Deserialize::JSON.pm
-# Created by: Adam Jacob, Marchex, <adam@hjksolutions.com>
-# Created on: 10/12/2006 03:00:32 PM PDT
-#
-# $Id$
-
 package Catalyst::Action::Deserialize::JSON;
 
 use strict;
index e2ca6fa..c4aad0c 100644 (file)
@@ -1,10 +1,3 @@
-#
-# Catlyst::Action::Deserialize::XML::Simple.pm
-# Created by: Adam Jacob, Marchex, <adam@hjksolutions.com>
-# Created on: 10/12/2006 03:00:32 PM PDT
-#
-# $Id$
-
 package Catalyst::Action::Deserialize::XML::Simple;
 
 use strict;
index ea2688b..6a7781f 100644 (file)
@@ -1,10 +1,3 @@
-#
-# Catlyst::Action::Deserialize::YAML.pm
-# Created by: Adam Jacob, Marchex, <adam@hjksolutions.com>
-# Created on: 10/12/2006 03:00:32 PM PDT
-#
-# $Id$
-
 package Catalyst::Action::Deserialize::YAML;
 
 use strict;
index d27be7d..6862f71 100644 (file)
@@ -1,10 +1,3 @@
-#
-# REST.pm
-# Created by: Adam Jacob, Marchex, <adam@hjksolutions.com>
-# Created on: 10/12/2006 03:00:32 PM PDT
-#
-# $Id$
-
 package Catalyst::Action::REST;
 
 use strict;
@@ -185,8 +178,8 @@ one of the accepted return formats.  You can do this by setting it in your query
 accepted return formats.  You can do this by setting it in your query string
 thusly: C<< ?content-type=application%2Fjson (where %2F == / uri escaped). >>
 
-B<NOTE> Apache will refuse %2F unless configured otherise.
-Make sure C<< AllowEncodedSlashes On >> is in your httpd.conf file in orde
+B<NOTE> Apache will refuse %2F unless configured otherwise.
+Make sure C<AllowEncodedSlashes On> is in your httpd.conf file in order
 for this to run smoothly.
 
 =back
index 47c150a..376344e 100644 (file)
@@ -1,9 +1,3 @@
-#
-# Catlyst::Action::Serialize.pm
-# Created by: Adam Jacob, Marchex, <adam@hjksolutions.com>
-#
-# $Id$
-
 package Catalyst::Action::Serialize;
 
 use strict;
index 24d88f1..9c6cad6 100644 (file)
@@ -1,9 +1,3 @@
-#
-# Catalyst::Action::Serialize::Data::Serializer
-# Created by: Adam Jacob, Marchex, <adam@hjksolutions.com>
-#
-# $Id$
-
 package Catalyst::Action::Serialize::Data::Serializer;
 
 use strict;
index 7423e9e..8da00ee 100644 (file)
@@ -1,10 +1,3 @@
-#
-# Catlyst::Action::Serialize::JSON.pm
-# Created by: Adam Jacob, Marchex, <adam@hjksolutions.com>
-# Created on: 10/12/2006 03:00:32 PM PDT
-#
-# $Id$
-
 package Catalyst::Action::Serialize::JSON;
 
 use strict;
index fe0b5c1..f91da2e 100644 (file)
@@ -1,10 +1,3 @@
-#
-# Catlyst::Action::Serialize::XML::Simple.pm
-# Created by: Adam Jacob, Marchex, <adam@hjksolutions.com>
-# Created on: 10/12/2006 03:00:32 PM PDT
-#
-# $Id$
-
 package Catalyst::Action::Serialize::XML::Simple;
 
 use strict;
index 4879af9..81fcc96 100644 (file)
@@ -1,10 +1,3 @@
-#
-# Catalyst::Action::Serialize::YAML.pm
-# Created by: Adam Jacob, Marchex, <adam@hjksolutions.com>
-# Created on: 10/12/2006 03:00:32 PM PDT
-#
-# $Id$
-
 package Catalyst::Action::Serialize::YAML;
 
 use strict;
index 7d6fb31..fddead3 100644 (file)
@@ -1,10 +1,3 @@
-#
-# Catlyst::Action::Serialize::YAML::HTML.pm
-# Created by: Adam Jacob, Marchex, <adam@hjksolutions.com>
-# Created on: 10/12/2006 03:00:32 PM PDT
-#
-# $Id$
-
 package Catalyst::Action::Serialize::YAML::HTML;
 
 use strict;
index 984457b..3f470fb 100644 (file)
@@ -1,9 +1,3 @@
-#
-# Catlyst::Action::SerializeBase.pm
-# Created by: Adam Jacob, Marchex, <adam@hjksolutions.com>
-#
-# $Id$
-
 package Catalyst::Action::SerializeBase;
 
 use strict;
index 99addac..43e781c 100644 (file)
@@ -36,8 +36,16 @@ Catalyst::Controller::REST - A RESTful controller
 
     # Answer PUT requests to "thing"
     sub thing_PUT {
-      ... some action ...
-    }
+        $radiohead = $req->data->{radiohead};
+        
+        $self->status_created(
+            $c,
+            location => $c->req->uri->as_string,
+            entity => {
+                radiohead => $radiohead,
+            }
+        );
+    }     
 
 =head1 DESCRIPTION
 
@@ -69,9 +77,11 @@ The serialization format will be selected based on the content-type
 of the incoming request.  It is probably easier to use the L<STATUS HELPERS>,
 which are described below.
 
-The HTTP POST, PUT, and OPTIONS methods will all automatically deserialize the
-contents of $c->request->body based on the requests content-type header.
-A list of understood serialization formats is below.
+"The HTTP POST, PUT, and OPTIONS methods will all automatically
+L<deserialize|Catalyst::Action::Deserialize> the contents of
+C<< $c->request->body >> into the C<< $c->request->data >> hashref", based on 
+the request's C<Content-type> header. A list of understood serialization
+formats is L<below|/AVAILABLE SERIALIZERS>.
 
 If we do not have (or cannot run) a serializer for a given content-type, a 415
 "Unsupported Media Type" error is generated.
@@ -512,8 +522,11 @@ method uses L<Catalyst::Action::Serialize>.  If you want to override
 either behavior, simply implement your own C<begin> and C<end> actions
 and use MRO::Compat:
 
-  my Foo::Controller::Monkey;
-  use base qw(Catalyst::Controller::REST);
+  package Foo::Controller::Monkey;
+  use Moose;
+  use namespace::autoclean;
+  
+  BEGIN { extends 'Catalyst::Controller::REST' }
 
   sub begin :Private {
     my ($self, $c) = @_;
index a0b827b..03c3869 100644 (file)
@@ -1,7 +1,3 @@
-#
-# REST.pm
-# Created by: Adam Jacob, Marchex, <adam@hjksolutions.com>
-# Created on: 10/13/2006 03:54:33 PM PDT
 package Catalyst::Request::REST;
 
 use strict;
index 01aa90a..c8675c2 100644 (file)
@@ -1,10 +1,3 @@
-#
-# Rest.pm
-# Created by: Adam Jacob, Marchex, <adam@hjksolutions.com>
-# Created on: 10/16/2006 11:11:25 AM PDT
-#
-# $Id: $
-
 package Test::Rest;
 
 use strict;
index 7c26976..923885e 100644 (file)
@@ -1,4 +1,3 @@
-
 package Test::Serialize;
 
 use FindBin;