Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Perl
Perl Misc
Perl + Dreamweaver?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Scott Bryce, post: 4787975"] <code snipped> And here it is using HTML::Template. Note that this simply sends output to the console. I will leave it to you to build this into a CGI application. Though this example does not make use of CGI.pm, I left the use statements in, assuming that you will expand this into a script that makes use of CGI.pm. FWIW, All I did was start with your code, and copy the relevant changes directly from the docs, with appropriate tweaks. --------- #!/usr/bin/perl use strict; use warnings; use CGI::Carp qw(fatalsToBrowser); use CGI qw(:standard); use HTML::Template; my $number = int(rand(10)) + 1; my $name = "Nikos"; my $day = "Tuesday"; my $template = HTML::Template->new(filename => 'test.tmpl'); $template->param(NUMBER => $number); $template->param(NAME => $name); $template->param(DAY => $day); # Appropriate headers go here print $template->output; ---------- <html> <head> <title>Today is <TMPL_VAR NAME=DAY>!</title> </head> <body> <h1>Hello <TMPL_VAR NAME=NAME>, how are are you today?</h1> <p>This is a random number generator: <TMPL_VAR NAME=NUMBER></p> </body> </html> ----------- [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Perl
Perl Misc
Perl + Dreamweaver?
Top