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.
In Section
Seekers of Perl Wisdom