[l2h] [Q] follow up query on running l2h as a cgi-bin program
Carl David
CHADM1@UCONNVM.UCONN.EDU
Wed, 10 Jan 2001 09:44:17 EST
Thanks to the people who answered, saying that what I was trying was OK.
But, although I've got latex2html "working" using a different computer, running
under AIX, there is still a problem here which I can't understand.
Part of the problem seems to be permissions.
Forgive me, here comes the code (which I think is small enough not to annoy
people):
#!/usr/local/bin/perl -w
use strict;
$|++;
#$ENV{PATH} = "/usr/local:/download/latex2html:/usr/local/teTeX/bin";
open(STDERR, ">&STDOUT");
# this is l2h.pl a program to edit a latex file and latex2html it
# so that it can be viewed in another browser window.
use CGI;
my $query = new CGI;
use CGI::Carp qw(fatalsToBrowser);
print $query->header;
my $TITLE="Latex2HTML editor/viewer";
print $query->startform;
print $query->textarea(-name=>'l2h_text',-default=>
'\documentclass[]{article}
\begin{document}
LaTeX text here (example)
$$
\sum_{\ell=2}^{\ll=7}\int_0^\infty e^{-\alpha x^2} dx = ?
$$
\end{document}'
,-rows=>20,-columns=>80);
print "<br>";
print $query->submit(-name=>'l2h',-value=>'submit to l2h');
print $query->endform;
print $query->dump();
chdir('/u/cdavid/public_html');
chmod(0555,"l2htemp");
chdir('/u/cdavid/public_html/l2htemp');
chmod(0555,"*");
system("ls -al");
system("rm *.html");
system("ls -al");
chdir('..');
if ($query->param('l2h_text') ne ''){
my $l2h_text = $query->param('l2h_text');
print "<br>l2h_text = $l2h_text";
open (TEMP_FILE,">/u/cdavid/public_html/l2htemp.tex");
print TEMP_FILE $l2h_text;
close TEMP_FILE;
my $command = "/usr/local/latex2html98p1/latex2html";
print "<br>executing (system) command: $command ";
if(system("$command","/u/cdavid/public_html/l2htemp.tex","\n")){
print "<br> problems with execution of $command";
};
print "<br> returned from execution of latex2html command";
}
print $query->end_html;
The actual installed program can be seen at
http://www.sp.uconn.edu/~cdavid/cgi-bin/l2h.pl
(where it can be tried)
(*there is a tilde before cdavid, which doesn't print on this IBM mainframe).
Can someone see why I'm having trouble.
By the way, STDERR is ported to STDOUT so that one can see what is happening
during the spawning process.
Thanks in advance.
Carl David