[Catalyst] sub default :Private versus sub xxx :Path

John Napiorkowski jjn1056 at yahoo.com
Tue Jul 11 16:48:46 CEST 2006


With Catalyst we now have three ways to hook an action to the package namespace (That I know of)

package myapp::Controller::demo

1) sub default :Private {...}
2) sub index :Private {...}
3) sub xxxxx :Path {...}

All the above match /demo and 1,3 match /demo/arg1/arg2, etc while 2 doesn't.

Now I know from the documentation that the primary function difference are in execution precedence 
and in the way they capture arguments.  I can see an advantage to the sub xxxx :Path way over sub default
because this way I can give my root actions a meaningful private name.  However I was wondering what
other reasons might people use sub xxxx :Path over sub default?  I'm just trying to put together a best
practices guide for new developers and this one I've been scratching my head over. Maybe we haven't figured 
out the best way to use all these great new features yet but I just wanted to here what other people thought.

-john





More information about the Catalyst mailing list