I'm not sure if this is able to be done due to the nature of the input which is a file ... I tried something like: ... 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.

The input is not a file, but an HTTP request. The HTTP request content includes the file embedded in it.

As you are suggesting running the script again using the command-line, this might be the simplest approach. Most (Plack-based) modern Perl web frameworks provide a command-line tool for doing this, so if you are using one of those, then check the documentation for it. For generic web servers such as a LAMP setup, you can use wget, curl, or lwp-download. Check the documentation on those for how to POST a request with a file attached. Windows has similar tools available. Watch out for recursion if you do this!

To avoid running the script twice, a more generic approach is to use a filter/handler. Again, this depends on the web framework, as any framework that buffers output can make this very easy to do. For Apache, check out: http://httpd.apache.org/docs/current/handler.html#examples


In reply to Re: Saving .cgi Output; Passing File As Argument? by thewebsi
in thread 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.