[Catalyst] PathPart help

Jason Kohles email at jasonkohles.com
Fri Nov 16 18:50:03 GMT 2007


On Nov 16, 2007, at 11:11 AM, Christopher H. Laco wrote:

> Interesting twist. Reminds me of the RHOX stuff..
>
> users/id/<id>
> users/name/<name>
>
> etc. Damnit. Now you have me thinking again. That setup is a great
> reason to keep REST and web controllers seperated. :/
>


The only problem with it is that I would love to be able to do this,  
but so far I haven't come up with a reasonable way to say 'chain from  
any of these controllers'.   i.e. it would be really nice to be able  
to do this:

sub base : Chained('/') PathPart('users') CaptureArgs(0) { }

sub id : Chained('base') PathPart('id') CaptureArgs(1) { }
sub name : Chained('base') PathPart('name') CaptureArgs(1) { }
sub email : Chained('base') PathPart('email') CaptureArgs(1) { }

And then be able to base later controllers on any of these, something  
like:

sub edit : Chained('id','name','email') PathPart('edit') Args(0) { }

I would also be nice to be able to have chain elements that didn't  
correspond to URLs, so you could do something like this:

sub has_user : Chained('id|name|email') NoPathPart CaptureArgs(0) { }
sub edit : Chained('has_user') PathPart('edit') Args(0) { }


I keep planning to dig into the dispatcher and figure out how to  
implement this (and multiple PathParts), but never enough TUITs...

-- 
Jason Kohles, RHCA RHCDS RHCE
email at jasonkohles.com - http://www.jasonkohles.com/
"A witty saying proves nothing."  -- Voltaire





More information about the Catalyst mailing list