Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Is it possible to write to STDIN ?

by RonW (Parson)
on Jul 21, 2014 at 20:46 UTC ( [id://1094559]=note: print w/replies, xml ) Need Help??


in reply to Is it possible to write to STDIN ?

Generically speaking, you can feed the STDIN of a child process like so:

open my $fh, '|command' or die "Can't run command: $!"; print $fh "input for command\n"; print $fh "more input for command\n"; close $fh;

More specific to your situation, years ago, I wrote a simple script to copy STDIN to a file, then set up Lighttp to run that script as a CGI. Then I opened a HTML file, with the form I needed to fill, in a web browser, filled in the form and submitted. I then edited (a copy of) the resulting file to create a template. with thta, I could use a script to test my target CGI by inserting various values into the template and feeding the result to the CGI script similarly to my code snippet above.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-19 21:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found