actually document the new request body_data method
John Napiorkowski [Fri, 20 Sep 2013 18:10:20 +0000 (14:10 -0400)]
lib/Catalyst.pm
lib/Catalyst/Request.pm

index 56dc5a2..8fc94d6 100644 (file)
@@ -3160,6 +3160,9 @@ installed it.  If you don't mind the XS dependency, you should add the faster
 L<Cpanel::JSON::XS> to you dependency list (in your Makefile.PL or dist.ini, or
 cpanfile, etc.)
 
+L<JSON::MaybeXS> is loaded the first time you ask for it (so if you never ask
+for it, its never used).
+
 =cut
 
 sub registered_data_handlers {
index 329254b..ab87e17 100644 (file)
@@ -351,6 +351,7 @@ Catalyst::Request - provides information about the current client request
     $req->args;
     $req->base;
     $req->body;
+    $req->body_data;
     $req->body_parameters;
     $req->content_encoding;
     $req->content_length;
@@ -433,6 +434,14 @@ Returns the message body of the request, as returned by L<HTTP::Body>: a string,
 unless Content-Type is C<application/x-www-form-urlencoded>, C<text/xml>, or
 C<multipart/form-data>, in which case a L<File::Temp> object is returned.
 
+=head2 $req->body_data
+
+Returns a Perl representation of POST/PUT body data that is not classic HTML
+form data, such as JSON, XML, etc.  By default, Catalyst will parse incoming
+data of the type 'application/json' and return access to that data via this
+method.  You may define addition data_handlers via a global configuration
+setting.  See L<Catalyst\DATA HANDLERS> for more information.
+
 =head2 $req->body_parameters
 
 Returns a reference to a hash containing body (POST) parameters. Values can