docs: section on params in Intro.pod
Jesse Sheidlower [Thu, 16 Jun 2005 00:54:55 +0000 (00:54 +0000)]
Changes
lib/Catalyst/Manual/Intro.pod
lib/Catalyst/Request.pm

diff --git a/Changes b/Changes
index 66d132c..754c608 100644 (file)
--- a/Changes
+++ b/Changes
@@ -7,6 +7,7 @@ This file documents the revision history for Perl extension Catalyst.
         - Added support for case sensitivity, MyApp->config->{case_sensitive}
         - Added $c->detach for non returning forwards
         - Added unified error handling, Catalyst::Exception
+        - Added section on param handling in Intro.pod
 
 5.23  2005-06-03 02:30:00
         - added support for non Catalyst::Base components to live in namespace
index c237c71..b59ad62 100644 (file)
@@ -485,6 +485,22 @@ Catalyst matches actions in most specific to least specific order:
 
 So Catalyst would never mistakenly dispatch the first two URLs to the '^foo$' action.
 
+=head4 B<Parameter Processing>
+
+Parameters are handled with methods in the L<Catalyst::Request>
+class. The C<param> method is functionally equivalent to the C<param>
+method of C<CGI.pm> and can be used in modules that require this.
+
+    # http://localhost:3000/catalog/view/?category=hardware&page=3
+    my $category = $c->req->param('category');
+    my $current_page = $c->req->param('page') || 1;
+
+    # multiple values for single parameter name
+    my @values = $c->req->param('scrolling_list');         
+
+    # DFV requires a CGI.pm-like input hash
+    my $results = Data::FormValidator->check($c->req->params, \%dfv_profile);
+
 =head3 Flow Control
 
 You control the application flow with the C<forward> method, which accepts the
index 27bda13..ee2bee7 100644 (file)
@@ -161,7 +161,7 @@ Shortcut for $req->body.
 
 =item $req->match
 
-This contains be the matching part of a regexp action. otherwise it
+This contains be the matching part of a regexp action. Otherwise it
 returns the same as 'action'.
 
     print $c->request->match;
@@ -174,7 +174,8 @@ Contains the request method (C<GET>, C<POST>, C<HEAD>, etc).
 
 =item $req->param
 
-Get request parameters with a CGI.pm like param method.
+Get request parameters with a CGI.pm-compatible param method. This 
+is a method for accessing parameters in $c->req->parameters.
 
     $value  = $c->request->param('foo');
     @values = $c->request->param('foo');