Hey guys, I have a pretty big script that makes a lot of print calls at various points to generate an html output -- is there anyway I can have the output save to the server automatically each time this is ran? If this was a more simple script I could just push the print statements to "whatever > /dir/name.html" but in this case that's not really an option.

I thought about making a system call to run the script again at the end, however I'm not sure if this is able to be done due to the nature of the input which is a file (users go to an .html front end page and then select the file to upload which is used for the script input). I tried something like:

system("perl /dir/script.cgi parametername='/dir/file' > /dir/output.html");

However the output html file I get just gives me my invalid file message so it doesn't look like it takes the input in that way. Is there a better way to approach this or should I be able to pass a file as a parameter in the system perl call?

In reply to Saving .cgi Output; Passing File As Argument? by Ragged Robin

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.