Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
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:
sub base : Chained('/') PathPart('item') CaptureArgs(1) {
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
in thread Catalyst: Using Chained for URL Dispatching and Sane Method Organization by stonecolddevin

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2024-04-19 22:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found