silent11 has asked for the wisdom of the Perl Monks concerning the following question:
I can't see what I'm doing wrong here -- I'm getting an error from the following line:
$template->param( warnings => \@warning ) || die $!;
Update:#!/usr/bin/perl use strict; use HTML::Template; use MIME::Lite; use CGI; use CGI::Carp qw/fatalsToBrowser/; use Data::Dumper; my $c = new CGI; validate( qw/ email phone/ ); my $c = new CGI; print $c->header,$c->start_html('everythings ok'); sub validate { my $c = new CGI; my @params = @_; my @warning; for ( @params ) { push (@warning, { 'missing' => $_ }) unless $c->param($_); } if ( @warning ) { print $c->header; my $template = HTML::Template->new(filename => './templates/warnin +g.html'); $template->param( warnings => \@warning ) || die $!; $template->output() || die $!; print Dumper @warning; exit; } }
The error
Content-type: text/html Software error: Died at /var/www/cgi-bin/ebranch/assignment/process.cgi line 28. For help, please send mail to the webmaster (root@localhost), giving t +his error message and the time and date of the error.
The Template
<span class="bigText"> Warning! The following fields are missing.< +/span> <TMPL_LOOP warnings> <TMPL_VAR missing><br /> </TMPL_LOOP>
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Error when passing AoH ref to HTML::Template
by davidrw (Prior) on Aug 17, 2005 at 19:42 UTC | |
by silent11 (Vicar) on Aug 17, 2005 at 19:49 UTC | |
Re: Error when passing AoH ref to HTML::Template
by kutsu (Priest) on Aug 17, 2005 at 19:57 UTC | |
by silent11 (Vicar) on Aug 17, 2005 at 20:03 UTC | |
by eric256 (Parson) on Aug 18, 2005 at 16:30 UTC | |
Re: Error when passing AoH ref to HTML::Template
by davidrw (Prior) on Aug 17, 2005 at 19:23 UTC | |
Re: Error when passing AoH ref to HTML::Template
by punkish (Priest) on Aug 17, 2005 at 19:57 UTC |
Back to
Seekers of Perl Wisdom