I see your question has already been answered thoroughly by the other fine monks, but I thought I might point out something that wasn't in your question. I notice you're doing a fair amount of directly printing HTML. You've probably heard this a thousand times, but this kind of thing should really be avoided. HTML::Template is my templating tool of choice, and I suggest you check it out. If you don't want the inconvenience of keeping a separate template file (though some may argue embedding the template directly in the Perl code is even less convenient), you can very easily put the text of the template in __DATA__ at the end of the script.
Here's a quick (and very untested) snippet showing how one might do such a thing:
#!/usr/bin/perl
use strict;
use warnings;
use HTML::Template;
my $var1 = 'foo';
my $var2 = 'bar';
my $template = HTML::Template->new(filehandle => *DATA);
$template->param(var1 => $var1);
$template->param(var2 => $var2);
print "Content-Type: text/html\n\n", $template->output;
__DATA__
<html>
<head>
<title>Test HTML::Template!</title>
</head>
<body>
<p>Var1 is set to <!-- TMPL_VAR NAME="var1" --><br/>
Var2 is set to <!-- TMPL_VAR NAME="var2" --></p>
</body>
</html>
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|