Perl Monk, Perl Meditation | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Chained attributes are like crack. Once you grok them and start using them you can't stop. They simplify code so much.I understand what chained attributes do. And Catalyst was a lot of fun to work with when it first came out. I would like to offer my viewpoint on solving the same problem. Personally, if you read what dhoss says chained attributes are for: Chained, however, allows you to chain together methods that need to share information across requests....Basically, in OO terms, what he is saying is that he has a sequence of methods that belong in the same class because they consume the same data. And if you look at the implementation: The use of the word 'base' is a dead giveaway. So, what I see here is the use subroutine overloading to give Catalyst hints about how to handle common object-oriented programming problems for you. I came up with a similar strawman example here. The big difference is that I used clean, standard class-based OO to create a base class and then allowed the derived class to share/refine behavior as needed. I personally dont like learning things like Catalyst and Template Toolkit. In my eyes, they are attempts to take what any OO Perl programmer can do himself and come up with syntactic trickery and shortcuts to make it easier for those who lack said sophistication. Just give me Moose, CGI::Prototype and HTML::Seamstress and the tried and true methods of OO programming which work in and out of Perl anyday over language-specific syntax games like this. But of course, we all have our preferences and I'm sure many people are getting great mileage out of Catalyst and Template, so more power to them! Thanks for the chance to offer a contrasting viewpoint. In reply to Re^2: Catalyst: Using Chained for URL Dispatching and Sane Method Organization
by metaperl
|
|