in reply to HTML::Template vs. CGI.pm

Your CGI example uses a loop to output the data from a @menubar array, but the same data is hard-coded in your HTML::Template example. You could have kept the array there and modified a lot less code:

my @menubar = ( . . . ); my $template = HTML::Template->new( filename => 'menubar.tmpl'); $template->param(MENUBAR => [ map {{ title => $_->{title}, width => $_->{width}, height => $_->{height}, param => $_->{param}, alt => $_->{alt}, }} @menubar ]); # Or maybe just: #$template->param(MENUBAR => \@menubar); print $template->output();

Notice that with CGI.pm, you're doing two things: specifiying what tag to use, and the data to place with that tag. That's one thing too many. In HTML::Template, you're only specifying what the data is, and you let the local HTML monkey worry about what the actual tags are.

As it happens, since I work at a company with a rather small IT staff, the HTML monkey for my projects is usually me. I still use HTML::Template because it is quite likely that the UI for my projects will change. We have people here who are much better at design then I am, but who don't know much programming. So I stick with the template so that they don't bug me just because the UI needs to change :)

----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer

: () { :|:& };:

Note: All code is untested, unless otherwise stated