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.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.