in reply to Meditations on templates

use templates if you code CGI programs that make it into the wild

I couldn't agree more. However, why reinvent the wheel when modules such as Template Toolkit, HTML::Template or HTML::Mason already exist and are really powerful?

Here's a pop-up creation example with Template Toolkit:

[% FOREACH country in country_hash %] <option value="[% country.key %]">[% country.value %]</option> [% END %]

If you think these modules have an unaffordable overhead, you may want to use the built-in CGI HTML construction functions. In your case, you could easily create a pop-up menu like this:

print $q->popup_menu('country_name', ['CA','NY','TN'], 'CA');

<pedant mode="on">[a-zA-Z0123456789\_\:] can be reduced to [a-zA-Z0-9_:]<pedant mode="off">

<kbd>--
my $OeufMayo = new PerlMonger::Paris({http => 'paris.mongueurs.net'});</kbd>

Replies are listed 'Best First'.
Re: Re: Meditations on templates
by davorg (Chancellor) on Apr 19, 2001 at 13:51 UTC
    <pedant mode="on">[a-zA-Z0123456789\_\:] can be reduced to [a-zA-Z0-9_:]<pedant mode="off">

    And even further reduced to [\w:] :)

    --
    <http://www.dave.org.uk>

    "Perl makes the fun jobs fun
    and the boring jobs bearable" - me

      Not if you are using a locale, and not with Unicode support...(since we are all using pedant mode...)