Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Template::Latex Frustrations . . .

by hesco (Deacon)
on May 06, 2010 at 04:39 UTC ( [id://838637]=note: print w/replies, xml ) Need Help??


in reply to Re: Template::Latex Frustrations . . .
in thread Template::Latex Frustrations . . .

CountZero:

Thank you kindly. That is exactly what was needed to move me off of stuck. I just deployed the app tonight. I believe it to be doing the trick as I write, based on feedback from three testers (including myself).

And the working code looks like this:

$self->{'tt'} = Template->new({ INCLUDE_PATH => $self->{'cfg'}->param("pdf.include_path"), OUTPUT_PATH => $self->{'cfg'}->param("pdf.tmp_path") }); $self->{'tt'}->process($template,{ field => $field },$self->{'pdf_ou +tput'} . '.tex',binmode => 1) || die $self->{'tt'}->error(); my $cwd = cwd(); chdir $self->{'cfg'}->param("pdf.tmp_path"); $ENV{'USER'} = $self->{'cfg'}->param("pdf.user"); $ENV{'HOME'} = $self->{'cfg'}->param("pdf.home"); `latexmk -pdf $tmp_file.tex`; chdir $cwd; rename "$tmp_file.pdf", $file; unlink <$tmp_file.*>; $self->{'pdf_output_file'} = $file; $self->{'pdf_output_file_name'} = $self->{'pdf_output'} . '.pdf';
As I see this posted, it seems I ought to refactor some of my config paramters which no longer point to pdf files but now to tex files. But other than that, your solution moved me forward in rather quick style.

This is meeting all of my requirements, with respect to filing the resulting file appropriately and avoiding the risk of race conditions which would corrupt our archives. I have control over what to name the files.

So far, the only complaint I've had about latexmk is how noisy it has been when I'm running my test suite. I'll have to review the --help on that script again. I'll bet their is a switch to quiet it down. But it was an easy install. I would be more comfortable calling methods somehow, for some reason using backticks other than in a quick throw-away script makes me nervous. But I have no idea if there is any reason for that.

With this trick, the only thing holding me back now is my rudimentary latex skills.

But I'd guess this will give me more reason to practice with that.

Thanks again for the lead.

-- Hugh

if( $lal && $lol ) { $life++; }
if( $insurance->rationing() ) { $people->die(); }

Replies are listed 'Best First'.
Re^3: Template::Latex Frustrations . . .
by CountZero (Bishop) on May 06, 2010 at 13:45 UTC
    Pleased to have been able to assist!

    Indeed latexmk is very loud by nature. calling it as follows:

    $result = `latexmk -pdf -f -silent $filenaam`;
    will quite it down a bit, but not totally.

    I usually add the -f (force) option, so latexmk doesn't quit at the first unresolvable error it encounters.

    the only thing holding me back now is my rudimentary latex skills
    Perhaps we should found a "LaTeXmonks" site, but thay will perhaps attract the wrong type of people! ;-)

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://838637]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2024-04-21 20:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found