I am a trainee and have to write a HTML-generating script. I use HTML::Template for that. Right now, I am currently stuck and get the following error: Attempt to set nonexistent parameter 'loop_name' - this parameter name doesn't match any decleration in the template file. What I want to get into the template is something like this: CUSTOMER -> DOMAIN -> MACHINE -> SCHEDULED_EXPORT_TIMES now, every machine can have more than one export a day. So right now I try to iterate through all the values and am stuck at the SCHEDULED_EXPORT_TIMES. Here's the Script:

for my $customer (keys %$bi) { for my $domain (keys %{$bi->{$customer}}) { my %customer_domain_data; $customer_domain_data{CUSTOMER}=$customer; $customer_domain_data{DOMAIN}=$domain; print "$customer\n\t$domain\n"; for my $host (keys %{$bi->{$customer}->{$domain}}) { my $schedule = $bi->{$customer}->{$domain}->{$host}->{BACK +UPCFG}->{EXPORT_SCHEDULE_1}->{VALUE}; if (defined $schedule) { my @schedule_rows_loop =(); my @schedule=split(/,/, $schedule); for my $dif_schedule(@schedule) { my %schedule_rows_data; print "\t\t$dif_schedule\n"; $schedule_rows_data{SCHEDULE}=$dif_schedule; print "\t\t $schedule_rows_data{SCHEDULE}\n"; push (@schedule_rows_loop, \%schedule_rows_data); print Dumper(@schedule_rows_loop); $template->param(SCHEDULE_ROWS => \@schedule_rows_ +loop); } } push (@customer_domain_loop, \%customer_domain_data); $template->param(CUSTOMER_DOMAIN => \@customer_domain_loop +); } } }

And here is the used part in the Template:

<TMPL_LOOP NAME=CUSTOMER_DOMAIN> <tr> <td><TMPL_VAR NAME=CUSTOMER></td> <td><TMPL_VAR NAME=DOMAIN></td> <td> <table style="Width:100%"> <TMPL_LOOP NAME=SCHEDULE_ROWS> <tr> <td><TMPL_VAR NAME=SCHEDULE></td> </tr> </TMPL_LOOP> </table> </td> </tr> </TMPL_LOOP>

I just recently started to learn PERL and I am not that fit in it, so bare with me and my probably silly mistakes!


In reply to HTML::Template frustrated... by iRemix94

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.