
siaco at id
Jun 16, 2000, 5:45 AM
Post #15 of 16
(1559 views)
Permalink
|
On Fri, Jun 16, 2000 at 08:35:03AM -0400, Erich L. Markert wrote: > Some things to notice... > > In your code you have: "qmail.log|" in your open() statement - I don't > think you want that if you are simply reading the file. No, I'm not reading the file, I'm reading output form /path/command </path/stdin_to_this_command | pipe. > Also, ALWAYS, ALWAY, ALWAYS close file handles via close() if you are > using open(). OK, OK, I always do close files (this time was a bad exception), and adding close(FILE) didn't help.... > > Ryszard Lach wrote: > > > > On Fri, Jun 16, 2000 at 08:41:18AM +0200, Gerald Richter wrote: > > > > > > > > open (FILE, "/path/command \</path/file |") or die; > > > > > > > > while (\<FILE>) { > > > > print OUT $_; > > > > } > > > > > > > > did not. I received Internal Server Error and the following in > > > > apache's error > > > > log: > > > > > > > > [Thu Jun 15 17:42:39 2000] [error] [client 192.168.1.66] > > > > malformed header from > > > > script. Bad header=<table>: /usr/lib/cgi-bin/embpcgi.pl > > > > > > > > what means, embperl skipped all html stuff inserted before script > > > > part. Do you > > > > have any ideas? > > > > > > > > > > I would guess it's the other way round. Your command has, for whatever > > > reasons, printed directly to stdout (and that will come out before the > > > output from Embperl), instead of the redirection to <FILE>. > > > > Well, I wouldn't say so. In this case the output would be seeable before static > > html tags, but it isn't. > > > > Look at this complete page code: > > > > ######################## > > <html> > > <head> > > <title>Statystyki poczty - summary of senders</title> > > </head> > > > > <body> > > [.- > > $escmode = 0; > > open(FILE, "/usr/local/qmailanalog/bin/zsenders > > \</var/log/qmail/qmail.log|") or die "Cant open file"; > > while(\<FILE>) { > > if ( m/^mess\s+/ ){ > > print OUT $_,"<br>"; > > next; > > } > > else { > > print "\<table>\n"; > > $_ =~ s/\s+/\<td>/g; > > print OUT "\<tr>\<td>$_\<br>\n"; > > last; > > } > > } > > > > while ( \<FILE> ) { > > $_ =~ s/\</</g; > > $_ =~ s/>/>/; > > $_ =~ s/^\s*/\<td>/; > > $_ = s/\s+/\<td>/; > > PRINT OUT "\<tr>",$_,"\n"; > > } > > > > print "\</table>"; > > $escmode = 1; > > -] > > </body> > > </html> > > ######################## > > > > This page produces (by embpexec.pl): > > > > <table> > > </table><html> > > <head> > > <title>Statystyki poczty - summary of senders</title> > > </head> > > > > <body> > > <tr><td><br> > > </body> > > </html> > > ############################ > > > > What is wrong with it? How can I debug this? > > > > Siaco. > > > > -- > > Ryszard ?ach > > Internet Designers s.c. > > http://www.id.pl > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: embperl-unsubscribe [at] perl > > For additional commands, e-mail: embperl-help [at] perl > > -- > __________________________________________________________ > Mr. Erich L. Markert emarkert [at] pace > Computer Learning Center TEL (914)422-4328 > Pace University > 1 Martine Ave > White Plains, New York 10606-1932 > > Those who do not understand Unix are condemned to reinvent it, poorly. > -- Henry Spencer > > --------------------------------------------------------------------- > To unsubscribe, e-mail: embperl-unsubscribe [at] perl > For additional commands, e-mail: embperl-help [at] perl > -- Ryszard Łach Internet Designers s.c. http://www.id.pl
|