I can't see what I'm doing wrong here -- I'm getting an error from the following line:
$template->param( warnings => \@warning ) || die $!;

#!/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; } }
Update:

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>


-silent11
Spread Firefox

In reply to Error when passing AoH ref to HTML::Template by silent11

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.