Here's the problem. I'm the new guy at a company and walked into discover that, amongst other things, they don't use CGI.pm for CGI scripts. They have a rather limited in-house script that is insufficient for our needs. I need to allow users to upload files images to our server, but their script won't handle it, so I need to use CGI.pm. However, for various reasons, we need to call their script first because it does a lot of funky stuff with the data that fits their in-house work. Naturally, since their script clobbers STDIN, CGI.pm can't get to the data on a
post (which is what I need when I use multipart/form-data).
So the question is, how do I preserve what's in STDIN so CGI.pm can read it? Here's Fastolfe's suggestion:
local($/);
$data = <STDIN>;
my $A = IO::String->new ($data);
my $B = IO::String->new ($data);
Later, CGI.pm would be called like the following:
use CGI ($B);
Any comments/suggestions? The IS manager agrees that we need to convert everything to CGI.pm, however, we probably have about 15,000 lines of code to go through and we can't do this before the site roll-out :( In short, I need to get a quick, ugly hack together and then fix this later.
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just go the the link and check out our stats.