Hello,
We have a large code base printing header, body and footers to the STDOUT
from the cgi scripts. Since all these are print statements, we have to go to
extreme measures to make sure we donot print the content more than once.
To clean things up (or at least start at it), we want to be able to trap the
output of print to a local buffer and then selectively flush or junk based
on the logic (for eg, if we decide to redirect at the end of the script,
then we want to junk the buffer).
I am looking for a quick solution which would allow me to override the
CORE::print function and simply write to a buffer (a perl scalar). Once I am
done with the processing, I can write out the buffer or junk it.
Is it possible to do this? What should I be careful of?
THanks,
Chetan