Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Ways to group elements of an AoH

by fmerges (Chaplain)
on Jan 04, 2009 at 21:40 UTC ( [id://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

Replies are listed 'Best First'.
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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://734056]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-04-18 11:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found