Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re^2: Pass the value from perl script to html page

by Hero Zzyzzx (Curate)
on May 04, 2005 at 16:20 UTC ( #454031=note: print w/replies, xml ) Need Help??

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.

#!/usr/bin/perl use warnings; use strict; use HTML::Template; use CGI qw/:standard/; print header(); my $template=HTML::Template->new(filehandle=>*DATA,die_on_bad_params=> +1); my @count; foreach(1..10){ my %hash; $hash{NUMBER}=$_; push @count,\%hash; } $template->param( HEAD_TITLE=>'Test HTML::Template Page', PAGE_TITLE=>'This is a test HTML page.', CONTENT=>'Here is some sample content', COUNT=>\@count ); print $template->output; __DATA__ <html> <title><!-- TMPL_VAR HEAD_TITLE ESCAPE=HTML --></title> </html> <body> <h1><!-- TMPL_VAR PAGE_TITLE ESCAPE=HTML --></h1> <p><!-- TMPL_VAR CONTENT ESCAPE=HTML --></p> <p>I can count!</p> <ul> <!-- TMPL_LOOP COUNT --> <li><!-- TMPL_VAR NUMBER --></li> <!-- /TMPL_LOOP --> </ul> </body> </html>

-Any sufficiently advanced technology is
indistinguishable from doubletalk.

My Biz

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://454031]
[choroba]: their = his or her
[Discipulus]: anyway once I proposed an automatic font decrease for post below -1, stepping every 5 votes: i'm still thinks it's a good idea but dunno if feasible
[shmem]: ...emulated dual in english
[shmem]: Discipulus: has that been in the CB? or in a PM node proper? for the latter case, can you provide the ID?
[Discipulus]: you seriously can use their in this way in eng?
[Corion]: Meh. $effin_bad_system has an interface breakdown and then loads events in parallel with events overtaking one another instead of being processed sequentially
[shmem]: Discipulus: dunno, but we do all the time ^^
[choroba]: Discipulus I was taught so by a Londoner
[shmem]: Corion: very clear case of missing sequence number
[Corion]: shmem: Yeah. I guess they have a sequence number but distribute the events across threads or machines or whatever.

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (11)
As of 2017-05-23 08:21 GMT
Find Nodes?
    Voting Booth?