[Catalyst] Catalyst::Action::REST

Bill Moseley moseley at hank.org
Mon Nov 20 18:48:54 GMT 2006


On Mon, Nov 20, 2006 at 09:05:14AM -0800, Adam Jacob wrote:
> use Catalyst::Controller::REST;
> 
> sub foo: Chained CaptureArgs(1) {
>     setup_widget(); 
> }
> 
> sub handle_foo: Chained('foo') PathPart('') ActionClass('REST') {} 
> 
> sub handle_foo_GET {
>     display_form();
> }
> 
> sub handle_foo_POST {
>     process_form();
> }

So what does that look like in real life?  What if process_form() fails
validation?

My urls look like this:

    /user           - list users
    /user/edit/1234 - edit/update that specific user.
    /user/edit      - create user
    /user/delete/1233

My create, edit, and update all use the same interface (form) so seems
to make sense that all those actions should use the same controller.
It also means my template can be set automatically based on the
controller's action name.



-- 
Bill Moseley
moseley at hank.org




More information about the Catalyst mailing list