hi all

 In Ruby we can detect if the current form's request is a post or not.

def controller_action
    if request.post?
              # Process post data as the user has submitted the form.
    else
        # Display form
    end
end


Looking at Catalyst::Request
(http://search.cpan.org/~mramberg/Catalyst-Runtime-5.71001/lib/Catalyst/Request.pm#$req-%3Eprotocol),
I found $req->method. The description says, "Contains the request method
(GET, POST, HEAD, etc)."

So, in Catalyst, would it be sufficient for me to do something like:

sub controller_action : Path('registration')
{
    if (($c->request->method eq 'POST') or ($c->request->method eq 'GET'))
    {
         # Process post data as the user has submitted the form.
    }
    else
    {
        # Display form
    }

   return 1;
}


Comments? Thanks


_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to