[Catalyst] [OT] ASP.NET MVC

John Napiorkowski jjn1056 at yahoo.com
Mon Dec 17 15:31:21 GMT 2007


--- Matt S Trout <dbix-class at trout.me.uk> wrote:

> On Tue, Dec 11, 2007 at 07:59:48AM -0800, John
> Napiorkowski wrote:
> > And with chaining you could create all the chained
> > actions in a single class, or use the Chain(.)
> feature
> > to spread this over a couple of controllers. 
> That's
> > what I usually do, but then you sometimes end up
> with
> > a mess of nearly empty controller classes.
> 
> I find they're usually only nearly empty at the
> beginning of development - by
> the time the app's gone through a couple of
> iterations they aren't anymore
> and you're glad you split things out.
>  
> > Then we also have :Local, which is also considered
> > somewhat deprecated in favor of :Path
> 
> Wrong.
> 
> Although to be honest I don't really use anything
> except :Chained these days :)
> 
> > :Default which
> > is recommended only for things like capturing bad
> URLs
> > and directing to a not found page (or if you are
> > clever, so sort of soundex or spelling correction
> to
> > see if that would match a known url)
> 
> 'default' and 'index' -are- deprecated.
> 
> You want
> 
> sub works_like_default :Path {
> 
> and
> 
> sub works_like_index :Path :Args(0) {
>  
> > Another potential disadvantage of this, besides
> the
> > confusion, is that you end up which a Controller
> > namespace generally having to map to your URI
> > namespace, and if you need to change the URI
> namespace
> > you end up renaming and moving controllers,
> around.
> 
> No. Really. Don't ever do this.
> 
> Chained doesn't pay attention to the controller
> name.
> 
> __PACKAGE__->config(prefix => 'foo')
> 
> changes the path prefix of the controller (for Path,
> Local,
> LocalRegex) without affecting the controller name,
> action
> namespace etc.
> 
> > What do the rest of you think?  What could be
> better
> > or more clear in terms of best practices?  Because
> I
> > think this is a place where a lot of newbies get
> lost,
> > and compared to the 'there's only a single way to
> do
> > it' method of using router classes, we can lose
> out. 
> 
> We could probably do with a 'guide to using
> Chained', and
> I've been pondering a cleaner syntax for it but
> don't really
> have anything I'm happy with yet.
> 
> Note also that as I keep telling people, setting
> action attributes
> via config makes it trivial to do a central routing
> table; just
> nobody seems to like the feature enough to write a
> guide to how to
> do it :)
> 
> > Also if we could work up an example that showed
> the
> > benefit of the Catalyst way that would also help
> us. 
> 
> The base class related examples I've posted a couple
> times demonstrate this.
> 
> If I work up an advent entry on them would you be
> willing to expand them for
> the main manual?

Matt, 

Yeah, the main configuration is definitely the right
place to be maintain centralized routing and to more
cleanly separate the URI namespace.  Just that as you
say, it's not clear to people when they first start
probably because there isn't a lot of people saying
that and the documentation and quick start guides
don't seem to promote that idea.

If you give me a template to start with, either as an
advent article or other I will definitely try to
expand it out, as long as you don't me giving it the
once or twice over.  

--john



> 
> -- 
>       Matt S Trout       Need help with your
> Catalyst or DBIx::Class project?
>    Technical Director                   
> http://www.shadowcat.co.uk/catalyst/
>  Shadowcat Systems Ltd.  Want a managed development
> or deployment platform?
> http://chainsawblues.vox.com/           
> http://www.shadowcat.co.uk/servers/
> 
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo:
>
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
>
http://www.mail-archive.com/catalyst@lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/
> 



      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping



More information about the Catalyst mailing list