Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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:

[% FOREACH recipient IN call_list %] \textbf{} & box & recipient.uid: & r +ecipient.fname recipient.lname & recipient.phones \\ \hline [% FOREACH sponsor IN call_list.recipient.upstream %] \multicolumn{2}{||r|}{} & sponsor.uid: +me & sponsor.fname sponsor.lname & sponsor.phones \\ [% END %] \hline [% END %]
The script itself includes:

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; }
$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.

When the template is processed, it is producing a .tex file including:

\textbf{} & box & recipient.uid: & r +ecipient.fname recipient.lname & recipient.phones \\ \hline \hline \textbf{} & box & recipient.uid: & r +ecipient.fname recipient.lname & recipient.phones \\ \hline \hline
And it never descends into the data structure to process the internal loop.

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(); }

In reply to Template::Latex not interpolating variables . . . by hesco

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2023-11-28 09:34 GMT
Find Nodes?
    Voting Booth?

    No recent polls found