in reply to CGI outputs plain text -- can't "Save Page As?"

I find it a bit strange too. Althought forementioned, I was really suprised that when I saved the output from FireFox to a file, that file contains nothing except the newline. Flock browser gave me the same result. However, I managed to save correctly with links (I didn't try it with old good lynx, I don't have it).

At first I thought it had something to do with the system function so I try to reproduce it with a simple script (system.cgi):

#!/usr/bin/perl print "Content-type: text/plain\n\n"; system 'uptime';
but it ran well on FireFox, it displayed the text on the browser, I could save it to a file, and the content is:
$ cat /tmp/uptime-system.cgi 09:08:55 up 1:10, 4 users, load average: 1.23, 0.80, 0.48
However, I'm a bit curious to see the appearantly overlapping code below the while {} block in convert_word2.cg. You may try to remove that code that reopen the $out file and let fiction_word_to_txt prints its output directly to the browser so you don't have to redirect it to a temporary file, like:
system("/home/bcrowell/Documents/programming/scripts/fiction_word_to_t +xt <$in") and die "error executing fiction_word_to_txt: $!\n";
Another possible option is to convert the doc file on the fly without external program so it works with filehandle. In other words, streaming the file. Is fiction_word_to_txt a Perl program? See also if OLE::Storage can help you.

Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!

Replies are listed 'Best First'.
Re^2: CGI outputs plain text -- can't "Save Page As?"
by bcrowell2 (Friar) on May 28, 2007 at 15:37 UTC

    AFAICT, the situation is that Firefox is trying to reload the page when you do a Save As. I think that would explain the difference in behavior between my script and your system 'uptime' script. Yours will reload (and give a later time), whereas mine won't work when you try to reload it, because it needs the file upload from the first script.

    Fiction_word_to_txt is just a wrapper for wvWare, plus a little bit of extra code for text-munging of wvWare's output.

      the situation is that Firefox is trying to reload the page when you do a Save As
      It sounds making sense. Too bad I can't find any reference regarding this from the net. It's just when loading the uptime script then doing Save As, my access log only shows single transaction log. LiveHTTPHeders also confirms this single transaction.

      Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!