in reply to Re: anonymous filehandle for overridden open sub
in thread anonymous filehandle for overridden open sub
Update: well, I was so sure the above wouldn't work that I didn't even try it...so I wasn't misled by the apparent success. Because Tanktalus's code doesn't use warnings, he/she is missing this:
Ambiguous call resolved as CORE::open(), qualify as such or use &So in fact the sub never even gets called. To call a sub with the same name as a builtin, you need to specify & (or have actually overriden the builtin as described in perlsub). Modifying the code to say &open(my $fh.... gives the error I was cautioning about:
Can't use string ("3") as a symbol ref while "strict refs" in usedue to the scalar prototype on open's first argument. (@_ == 3).
|
|---|