in reply to HTML::Template - how to handle TMPL_LOOP parameter if no rows returned

my $logged_events = []; should do the trick.

But it reads much nicer if you do it this way:

my @logged_events; push @logged_events, $_ while $_ = $sth_le->fetchrow_hashref(); my $cordr_template = HTML::Template->new(filename=>$pdp_template, die_on_bad_params =>0, ); $cordr_template->param( KPI => $kpi, THRES => $pdp_thres, DATETIME => $currDateTime, NEW_EVENTS => $new_events, LOGGED_EVENTS => \@logged_events, ) +;

(modulo some code alignment you could also improve)

Replies are listed 'Best First'.
Re^2: HTML::Template - how to handle TMPL_LOOP parameter if no rows returned
by hmadhi (Acolyte) on Mar 04, 2011 at 10:06 UTC
    Thanks - It now works as expected !!!

    Also thank you for additional advice