Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Saving .cgi Output; Passing File As Argument?

by thewebsi (Scribe)
on Oct 20, 2014 at 19:37 UTC ( [id://1104485]=note: print w/replies, xml ) Need Help??


in reply to Saving .cgi Output; Passing File As Argument?

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1104485]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2024-03-28 12:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found