in reply to
Re: Pass the value from perl script to html page
in thread Pass the value from perl script to html page
I realize you're just trying to be helpful, but I can't help but think code handouts like this harm a programmer learning perl in the medium term.
What is a new programmer more likely to do:
- Copy and paste this minimally functional templatting system that kinda works, or
- Do the ultimately more productive thing and learn how to install and use modules from CPAN.
Most newer programmers will probably choose the first, lesser productive route (but you know what they say about assumptions).
Just saying. A nudge to use something like HTML::Template with some sample code would probably be more helpful over the long term.
Here's something I whipped up to demonstrate some of what HTML::Template can do.
use CGI qw/:standard/;
HEAD_TITLE=>'Test HTML::Template Page',
PAGE_TITLE=>'This is a test HTML page.',
CONTENT=>'Here is some sample content',
<title><!-- TMPL_VAR HEAD_TITLE ESCAPE=HTML --></title>
<h1><!-- TMPL_VAR PAGE_TITLE ESCAPE=HTML --></h1>
<p><!-- TMPL_VAR CONTENT ESCAPE=HTML --></p>
<p>I can count!</p>
<!-- TMPL_LOOP COUNT -->
<li><!-- TMPL_VAR NUMBER --></li>
<!-- /TMPL_LOOP -->
-Any sufficiently advanced technology is
indistinguishable from doubletalk.