My solution has been CGI::FastTemplate.
If the site has a consistent look and feel that you are trying to maintain,
have your HTML guys create an html file that looks like it "should", and put a 1 element table in the center.
Its contents will be '$TEMPLATE'. Using CGI::FastTemplate, the code can look like:
use CGI qw/:standard/; # for html shortcuts
use CGI::FastTemplate;
# code here
# creates an HTML string called $template, i.e.
my $template = table({-width => "641",
-align => "center",
},
Tr(td(
font({-color => "#3399CC"},
"There were errors in the form input:")),
(map {h2("$_:"), h3(ul( map (li(i(mapfieldname($_))), @{$errors{$_}}) ))} keys %errors)
)));
# and now show the results
my $tpl = new CGI::FastTemplate("/home/httpd/html/templates");
$tpl->define( finished => "output.tpl" );
$tpl->clear_href;
$tpl->assign( { TEMPLATE => $template } );
$tpl->parse( FINISHED => "finished" );
print header();
$tpl->print;
exit;
After that, your scripts will only be responsible for printing what is relevant to you, w/o having to try and write too much html (that's what the HTML guys are there for, right? :-).
If you really want to go there, you can even have the HTML guys use CSS and reference the styles in your (script generated) output.