[Catalyst] Chained actions with can't terminate with :PathPart('') ?

J. Shirley jshirley at gmail.com
Fri May 7 17:43:49 GMT 2010


On May 7, 2010, at 10:12 AM, Evan Carroll wrote:

> I have two destinations in my Catalyst app
> 
> /auth/company/5/lot
> /auth/company/5/lot/5
> 
> This works and is often seen in Catalyst apps to achive this effect.
> sub lot :Chained('/auth/company') :CaptureArgs(1) {
> sub view_lot :Chained('/auth/company') :PathPart('') :Args(1) {
> 
> However, I would also expect the below to work; but, it seems it doesn't. I
> can only formulate the effect I want the above way. This is
> unfortunate because if all chained descendants of `lot` utilize a
> check provided here in the chain, then shouldn't `view_lot` also get
> to utilize that code? It would certainly be nice to eliminate
> redundant code here.
> sub lot :Chained('/auth/company') :CaptureArgs(1) {
> sub view_lot :Chained('/auth/company/lot') :PathPart('') :Args(0) {
> 
> I think it is also confusing to those that first encounter it.
> 
> I always know that I could just call it /view, and be done with it, but still.
> /auth/company/5/lot/5/view rather than, /auth/company/5/lot/5
> 
> But, I just wanted to know what others thought of this.
> 

Your chain you list in the top doesn't quite make sense.

Should view_lot be chained to Lot?  If not, the path would be /auth/company/*/*

You don't have an end-point attached to 'lot' either, so that chain would never be resolved.

-J


More information about the Catalyst mailing list