hesco has asked for the wisdom of the Perl Monks concerning the following question:
I have a script which parses /etc/log/maillog and builds a hash of bounced email addresses, doing a few database interactions to identify the names and phone numbers of the recipients going without their email.
Today I'm adding Template::Latex to the mix to generate a report which might be useful for tracking down corrections to the bouncing email. But for some reason my variable substitutions are not happening.
My template includes the following:
The script itself includes:[% FOREACH recipient IN call_list %] \textbf{recipient.email} & box & recipient.uid: recipient.name & r +ecipient.fname recipient.lname & recipient.phones \\ \hline [% FOREACH sponsor IN call_list.recipient.upstream %] \multicolumn{2}{||r|}{sponsor.email} & sponsor.uid: sponsor.na +me & sponsor.fname sponsor.lname & sponsor.phones \\ [% END %] \hline [% END %]
$call_list arrives as a hashref, with the bouncing email addresses used as keys, each containing a data structure for the bounced recipient, plus a key called 'upstream', which includes an arrayref of anonymous hashes for the folks who brought the bounced recipient into the mix.sub produce_report { my $call_list = shift; my $vars = { 'call_list' => $call_list }; print Dumper($vars); $tt->process('nightly_bounced_emails_report.tex.tt2', $vars, 'bounced_email_report.pdf', binmode => 1) || die $tt->error(); return; }
When the template is processed, it is producing a .tex file including:
And it never descends into the data structure to process the internal loop.\textbf{recipient.email} & box & recipient.uid: recipient.name & r +ecipient.fname recipient.lname & recipient.phones \\ \hline \hline \textbf{recipient.email} & box & recipient.uid: recipient.name & r +ecipient.fname recipient.lname & recipient.phones \\ \hline \hline
Can anyone please advise how I can get my template variables interpolated instead, please?
Any clues appreciated.
-- Hugh Esco
if( $lal && $lol ) { $life++; }
if( $insurance->rationing() ) { $people->die(); }
if( $insurance->rationing() ) { $people->die(); }
Back to
Seekers of Perl Wisdom