OK... print STDERR "....", ... is not being parsed as a file handle, but as a subroutine call with no brackets... for some reason I thought that required a prototype :-(
The second version, with a () prototype clearly stops that happening.
So the problem is that the subroutine-ness of the modified STDERR is taking precendence over the filehandle-ness -- which is a shame, really.
There are, of course, any many ways of creating a $XXX version of STDERR... what I was hoping for was a way to tweak a FH so that it can appear equally in: print FH .... and p_sub(FH, ....).
Because STDERR is visible everywhere, sub STDERR () { *STDERR } ; placed anywhere very nearly -- but not quite :-( -- does the job without every module needing to do, say, my $STDERR=*STDERR{IO} for itself.
Chris
In reply to Re^2: sub STDERR { *STDERR } -- nearly works !
by gone2015
in thread sub STDERR { *STDERR } -- nearly works !
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |