in reply to Re: Re: Re: Variable from a variable: the dark side?
in thread Variable from a variable: the dark side?
Of course, the bare 'type' template param returns a strict error, hence the no strict 'subs'. However, all the warnings notwithstanding, I think I'm relatively safe. Thanks all.#!/usr/bin/perl use warnings; use CGI::Carp qw(fatalsToBrowser); use HTML::Template; use strict; use CGI; my $query = new CGI; my $t = $query->param('type'); my @option; $option[1] = $query->param('option1'); $option[2] = $query->param('option2'); $option[3] = $query->param('option3'); $option[4] = $query->param('option4'); my $template = HTML::Template->new(filename => '../htmltemplatetests.t +mpl', associate => $query,die_on_bad_params => 0); { no strict 'subs'; $template->param( type.$t => "1", option.$_ => $option[$_]) for (1 .. 7); } print "Content-type: text/html\n\n"; print $template->output(); exit();
|
|---|