Hi,
I am going to use Tie::Handle::ToMemory to collect a program's output via STDOUT into a scalar. As such, I have a package that takes care of saving STDOUT, replacing it with a tied handle and, later, postprocessing the collected output and restoring the original STDOUT. As such, this package will at one time call untie *STDOUT; in order to get rid of the tie, but this yields a warning about 1 inner reference that still exists.
Now I am not entirely sure what this warning actually points to, but even a small test script that undefs just about anything it can, except *STDOUT - of course, since that's what I want to untie -, still throws the same warning.
After doing some research (read: wild Googling), I learned that this warning is being suppressed if the tied package defines an UNTIE sub and, io and behold, saying BEGIN { sub Tie::Handle::ToMemory::UNTIE {} } does in fact get rid of the warning - but I'm a little curious about that.
Is there a good reason why Tie::Handle::ToMemory does not define UNTIE itself?
And if so, is there a good reason that I'm not aware of why shoving UNTIE down its throat is a Bad Idea™?
And finally, if there is such a reason, is there a way other than { no warnings qw(all); untie *STDOUT; } to avoid the warning?
Cheers,
-- Jens
(0)
]
