jettero has asked for the wisdom of the Perl Monks concerning the following question:

Help me!!!

I've been working on a sandwich order form for my favorite deli around the corner. Oh man, they make good sandwiches. Anyhoo, I elected to use latex to produce the postscript for the fax transmission. ... From a Makefile or a shell you can make latex think there's a controlling terminal if you run 'latex file.tex < /dev/null'.

From a CGI, however, the /dev/null trick doesn't work!

How can I use perl to make latex think there's a controlling terminal during a CGI execution?

Replies are listed 'Best First'.
Re: latex
by tilly (Archbishop) on Aug 06, 2000 at 07:41 UTC
    TCL's Expect was very good at fooling processes into believing that they were dealing with a terminal. I would be highly surprised if the Perl version, the Expect module, was not likewise.

    So try to launch latex through Expect and see how well that works. (I believe that the Cookbook recomments this approach but I don't have a copy at home.)

Re: latex
by cmburns (Acolyte) on Aug 06, 2000 at 11:25 UTC
    Hi! I'm not quite sure if this will solve your problem, but have you tried the latex commandline-option
    -interaction=nonstopmode
    This way, latex should not expect any input, even on errors.
      Well, that's not a very perl way to do it. It's probably the solution I'm going to use though. Had I know that option existed, I would not have asked the question. I thought I had looked everywhere for such a switch, where on earth did you find it?

      update: -interaction=nonstopmode ... is cool, but I have basically the same problems! I don't understand why I'm having so much trouble just cuz I'm calling this from a CGI. I even did a 'su - nobody' and executed the commands as they appear in the CGI (everything was keen when I typed it by hand) :{.

      another update: This problem is solved. I did use -interactive=nonstopmode, but get this:

      while(<T>) { if(m/[{]ONF ([^}]+)[}]/) { my $v = $1; my $sv = shift @ONFs; push @ONFs, $v if $sv =~ /ding/; s/ONF/$sv/; } s/NAME/$fields{name}/; print U "$_"; } #close T, U; # wasn't closing U in time! close T; close U; `( cd $dir; [ -f $tname.tex ] && latex --interaction=nonstopmode $ +tname.tex 2>/dev/null [ -f $tname.dvi ] && dvips -f $tname.dvi [ -f $tname.ps ] && lpr $tname.ps )`
      When I tried to close both T and U at the same time, the tex file wasn't fully written by the time I got to the shell fork. wtf?
Re: latex
by SuperCruncher (Pilgrim) on Aug 06, 2000 at 14:42 UTC
    A Q&D solution would be to make a shell script, and put latex file.tex < /dev/null' in the shell script? By specifying the shell on the shebang line, wouldn't you be in effect running latex from the shell?