Surprisingly, no one managed to hit the reason why this fails.
Sorry for tooting my own horn here, but some of us did :-) .
In your original code, $filehandle is referencing a global glob. With your new code, $filehandle is now ... undef.
Therefore, give the overriding open a non-undef lexical handle instead: open(my $AFILE = IO::File->new(), ... ). This solution has the virtue that it does not require that the overriding open be modified, something that may not be possible or desirable.
the lowliest monk
In reply to Re^2: anonymous filehandle for overridden open sub
by tlm
in thread anonymous filehandle for overridden open sub
by blahblahblah
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |