Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Dear monks,

thanks for your insightful comments.

I will "go with the crowd" as sundialsvc4 in Re: The hidden charm of Template::Toolkit (and templates generally) suggested, with the (probably less populous) mason crowd.

Although I think modules are equivalent to mason components, the mason componenents use different (lowercased) names and path tree which distinguish them better from Controller and Model components, than some MyApp::View::Books, ... view perl modules. Also Mason is already used in my company.

I don't want to bother you with repeating myself, the following lines are meant mostly for my relief.

Personally I consider templates being "false mistresses". They are seducing you with: "Don't code, let's go templating", but soon after start you will meet variables, loops, conditions, methods, ...

The example below is taken from Catalyst tutorial, it is pretty simple and yet it contains a bit of programming, while the authors are not even linked.

[% FOREACH book IN books -%] <tr> <td>[% book.title %]</td> <td>[% book.rating %]</td> <td> [% tt_authors = [ ]; tt_authors.push(author.last_name) FOREACH author = book.a +uthors %] [% # Now use a TT 'virtual method' to display the author cou +nt in parens -%] ([% tt_authors.size %]) [% # Use another TT vmethod to join & print the names & comm +a separators -%] [% tt_authors.join(', ') %] </td> </tr> [% END -%]

In Mason, you start with plain HTML interspersed with occasional perl lines and end up with components, subcomponents, filtering, attributes, methods, ...

However If the only risk of inappropriate tool for view implementation are difficulties caused by my cubicle being tsunamized (Re: The hidden charm of Template::Toolkit (and templates generally)) I stay calm. In Czech republic, I can take the risk. :-)


In reply to Re: The hidden charm of Template::Toolkit (and templates generally) by roman
in thread The hidden charm of Template::Toolkit (and templates generally) by roman

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 romping around the Monastery: (2)
As of 2024-04-25 22:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found