Lori713 has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to concatenate some strings and a CGI variable together so I can create the template name to be used in my program. Below is what I have, but I get the error message,
"HTML::Template->new() : Cannot open included file $rpt_tmpl : file not found. at HTML/Template.pm line 1580".
Am I using HTML::Template incorrectly? If I hard-code what I want (cnc1_rpt1_summary.tmpl), it works beautimously and my $rpt_id value is "1".
Thanks for any help you can provide!
#!/usr/local/bin/perl5_8 use strict; use warnings; use CGI; use CGI::Carp qw(fatalsToBrowser); #remove for PRD use HTML::Template; use DBI; use My::pswd; my $CGI = CGI->new; $|=1; print "content-type: text/html\n\n"; my $err; my $server = $My::pswd::server; my $userid = $My::pswd::userid; my $passwd = $My::pswd::passwd; my $rpt_id = $CGI->param('rpt_id'); my $proj_id = $CGI->param('proj_id'); my $rpt_asofdt = $CGI->param('rpt_asofdt'); my $rpt_tmpl = "cnc1_rpt" . "$rpt_id" . "_summary.tmpl"; my $template = HTML::Template->new( filename => '$rpt_tmpl', associate => $CGI, ); #.... and then a bunch of other stuff (fetch data, #fetch futzed (for now) params to pass to template .... print $template->output(); #temp: just to show my variable values; remove for PRD print "my rpt_id is: $rpt_id<br>"; print "my proj_id is: $proj_id<br>"; print "my rpt_asofdt is: $rpt_asofdt<br>"; print "Good-bye Cruel World.\n";
Lori
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: HTML::Template, CGI - concatenating strings & variables
by jeffa (Bishop) on Nov 17, 2003 at 14:59 UTC | |
by Lori713 (Pilgrim) on Nov 17, 2003 at 15:09 UTC | |
by jeffa (Bishop) on Nov 17, 2003 at 18:59 UTC | |
by Lori713 (Pilgrim) on Nov 17, 2003 at 20:15 UTC | |
by jeffa (Bishop) on Nov 17, 2003 at 20:20 UTC | |
| |
by jgallagher (Pilgrim) on Nov 17, 2003 at 20:26 UTC |