Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Ways to group elements of an AoH

by fmerges (Chaplain)
on Jan 04, 2009 at 21:40 UTC ( #734056=note: print w/ replies, xml ) Need Help??


in reply to Ways to group elements of an AoH

Hi,

I would recommend you to use also another template system, aside of HTML::Template module for certain situations, as the transformations you need to do most times outweight the benefits of using HTML::Template, creating a code which is not so maintainable, and more centered to overcome the limitations of the module.

Update: seems to be that people are misunderstanding what I'm trying to say which is that for more complex structures than simple AoH, you end up transforming the data to make it work. I'm not saying in any means that the module is not nice and very useful, which is not the case. I also do use it a lot.

Regards,

fmerges at irc.freenode.net


Comment on Re: Ways to group elements of an AoH
Re^2: Ways to group elements of an AoH
by bradcathey (Prior) on Jan 05, 2009 at 01:03 UTC

    Hmmmm, strong words for one of the more revered CPAN modules, and you offer no examples or recommendations, just generalizations.

    —Brad
    "The important work of moving the world forward does not wait to be done by perfect men." George Eliot

      Hi,

      If you read carefully I say also. Thinking these are strong words is misinterpreting what I'm saying.

      Just read the way the loop works in HTML::Template, and then think about a structure which is not a AoH, tip what about iterating through a regular array?

      # given my @array = qw(apple orange peach); # now you have to change this to my @new_arr = map { { name => $_ } } @array; # and now you can say $template->param(fruits => \@new_arr);

      You want valid alternatives, check out HTML::Mason, Template::Toolkit. Yes one is not a pure templating and the other one is heavy, that's why I say also.

      Update: modified the example code to show more clearly the transformation required.

      Regards,

      fmerges at irc.freenode.net

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://734056]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2014-12-25 21:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (163 votes), past polls