in reply to How to preserve the value of STDIN
You could actually even do without the 2nd variable:
Since $A isn't a native file handle, you can't seek() on it, but this will do just as well and should be indistinguishable from your two separate processes.my $A = new IO::String ($data); &exhaust_file_handle($A); # read everything from $A $A->setpos(0); # rewind &also_exhaust($A); # 2nd process reads everything from $A
You will also need to do this in a BEGIN { } block, so that all of this mangling of STDIN is done before use CGI ($A) is called.
|
|---|