[Catalyst] RESTful perl implementations...

Matt S Trout dbix-class at trout.me.uk
Tue Sep 26 19:36:02 CEST 2006

Garrett Goebel wrote:
> On Sep 26, 2006, at 10:08 AM, John Napiorkowski wrote:
>> -- Garrett Goebel <ggoebel at goebel.ws> wrote:
>>> I'm sure this is too late to be useful. But here is
>>> my subclassed
>>> Catalyst::Action to implemented RESTful request
>>> method based
>>> dispatching. [I've been working on this in my free
>>> time. Which I have
>>> precious little of lately. My apologies.]
>>> The references to $c->request->path_parameters are
>>> to support RoR
>>> style processing of urls (foo.com/person;create)
>>> where
>>> Catalyst::Dispatcher->perpare_action is overridden
>>> to match url paths
>>> separate from path parameters and file extensions.
>>> I also override Catalyst::Dispatcher->setup_actions
>>> to change the
>>> default method_action_class to my subclass of
>>> Catalyst::Action. I was
>>> surprised that default method_action_class and
>>> action_container_class
>>> appear to be hard coded...
>> [snipped content]
>> You can do this more easily as a Action Class, (see
>> http://search.cpan.org/~mramberg/Catalyst-Runtime-5.7003/lib/ 
>> Catalyst/Manual/Actions.pod
>> for some documentation).  This was released with
>> Catalyst 5.7x and easy to miss if you don't have time
>> to watch the mailing list closely.
> I don't really like :ActionClass. I'd rather my action method  
> attributes declare what they match... not how.

You can handle this by adding a _parse_Foo_attr method to a controller base 
class - c.f. how _parse_Local_attr converts :Local to the equivalent :Path 
declaration (Catalyst::Base).

      Matt S Trout       Offering custom development, consultancy and support
   Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +

More information about the Catalyst mailing list