[Catalyst] Dispatch matching more than the path?
Matt S Trout
dbix-class at trout.me.uk
Tue Aug 22 10:49:57 CEST 2006
Garrett Goebel wrote:
> I've been looking at Audrey Tang's Jifty::Plugin::Dispatcher::REST
> (http://pugs.blogs.com/pugs/2006/07/rhox_slides_las.html) and DHH's
> "Discovering a world of Resources on Rails"
> (http://www.loudthinking.com/lt-files/worldofresources.pdf) presentation
> from the 2006 RoR conference. I'm trying to work up something similar
> for Catalyst.
>
> My understanding from reading Catalyst's source, is that its dispatcher
> exclusively matches on path. I'm finding that I often want to
> collectively match the path, request method and uri path parameters
> (i.e., what follows the ';' in the path segments of the path components
> of the uri).
>
> I hacked something into the Path and Regex dispatchers to get collective
> matching on method and path working in the prototype.
You shouldn't need to hack anything into these; just use a custom ActionClass
that overrides $action->match to introspect onto the request method and
anything else you need (this is already how :Args is handled, see the
Catalyst::Action source for the implementation).
--
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