Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: display hash in an html template

by Kanji (Parson)
on Nov 03, 2005 at 15:29 UTC ( #505393=note: print w/replies, xml ) Need Help??

in reply to display hash in an html template

You may want to consult the FAQ section of HTML::Template's POD. Specifically...

Q: What's the best way to create a <select> form element using HTML::Template?

A: There is much disagreement on this issue. My personal preference is to use's excellent popup_menu() and scrolling_list() functions to fill in a single <tmpl_var select_foo> variable.

To some people this smacks of mixing HTML and code in a way that they hoped HTML::Template would help them avoid. To them I'd say that HTML is a violation of the principle of separating design from programming. There's no clear separation between the programmatic elements of the <form> tags and the layout of the <form> tags. You'll have to draw the line somewhere - clearly the designer can't be entirely in charge of form creation.

It's a balancing act and you have to weigh the pros and cons on each side. It is certainly possible to produce a <select> element entirely inside the template. What you end up with is a rat's nest of loops and conditionals. Alternately you can give up a certain amount of flexibility in return for vastly simplifying your templates. I generally choose the latter.

Another option is to investigate HTML::FillInForm which some have reported success using to solve this problem.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://505393]
[moritz]: if you don't have .pm file, you might to use "require" or "do" with an absolute path
[ovedpo15]: I need to use FindBin thought. does FindBin finds only modules? or it can find perl script also?
[moritz]: maybe you should start looking at the documentation of FindBin?

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2018-03-17 20:51 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (226 votes). Check out past polls.