- or download this
# secret.pl
use HTML::Template;
...
my $template = HTML::Template->new(filename => 'secret.tmpl');
$template->param(SECRET_MESSAGE => $bar);
print $template->output;
- or download this
<!-- secret.tmpl -->
<h1>Hello <TMPL_VAR NAME=SECRET_MESSAGE></h1>
- or download this
<!-- secret2.tmpl -->
<TMPL_IF NAME="ILLUMINATI">
...
SECRET_MESSAGE => 'There is no Perl Illuminati',
);
print $template->output;
- or download this
<!-- secret2.tmpl -->
<TMPL_IF NAME="SECRET">
...
my $template = HTML::Template->new(filename => 'secret2.tmpl');
$template->param(SECRET => $message);
print $template->output;
- or download this
<!-- students.tmpl -->
<TMPL_LOOP NAME=STUDENT>
...
]
);
print $template->output;
- or download this
<!-- songs.tmpl -->
<html>
...
$DBH->disconnect();
- or download this
push @{$rows}, $_ while $_ = $sth->fetchrow_hashref();
- or download this
{
'artist' => 'Van Halen',
...
'album' => 'Van Halen II',
'year' => '1979',
};
- or download this
# we don't need no stinkin' column names
my $rows = $DBH->selectall_arrayref('select * from songs');
...
die_on_bad_params => 0,
);
$template->param(ROWS => $rows);
- or download this
my $CGI = CGI->new();
my $template = HTML::Template->new(
filename => 'foo.tmpl',
associate => $CGI,
);
- or download this
<!-- pill.tmpl -->
<table>
...
loop_context_vars => 1,
);
# etc.
- or download this
my $template = HTML::Template->new(scalarref => \$scalar);
- or download this
#!/usr/bin/perl -Tw
use DBI;
...
</body>
</html>