[Catalyst] Catalyst::Action::REST

Adam Jacob adam at stalecoffee.org
Mon Nov 20 20:08:17 GMT 2006


On Mon, Nov 20, 2006 at 08:50:18PM +0100, Robert 'phaylon' Sedlacek wrote:
> 
> Bill Moseley said:
> 
> > So what does that look like in real life?  What if process_form() fails
> > validation?
> 
> Well, this is my plan. Although it's written with :Method syntax, but
> that's only a slight difference I assume.

..snip Method code..

> To list the chains:
> /foo -> base, list|head
> /foo/123/edit -> base, form, load, edit|save
> /foo/create -> base, form, create|do_create
> 
> Might look like many actions at first, but they do very little stuff. I'd
> probably also add some controller base magic to do a _NoForm attribute to
> tie to load when I don't need a form. A simple 'view' action for example.
> Well, ideally the widget system would know how to render as form _and_ as
> static display.

If you get to the point where you need to provide both a serialized
interface (XML, YAML, JSON) look at using the
Catalyst::Action::Serialized and ::Deserialized from the
Catalyst::Action::REST distribution.  Extending it to "do the right
thing" with a text/html request is definetly a possibility. (Where
"right thing" is probably just hand things to the default view)

Adam




More information about the Catalyst mailing list