How do I dynamically redefine imported subroutines?
That's actually quite easy, but say is not being imported; it's not even a subroutine! say is an operator, and use feature 'say'; merely controls whether the compiler recognises it or not. (It always recognises CORE::say, though.)
Some operators can be overridden from within Perl by overriding GLOBAL::CORE::op, and some can't. The following checks whether say can be overridden this way:
>perl -E"say defined(prototype('CORE::say')) ?'yes':'no'" no
Its funky syntax doesn't permit it.
say say LIST say FILEHANDLE LIST say BLOCK LIST
It could be done using a CallChecker, but that involves dropping to C/XS.
In reply to Re: Redefining Imported Subs: of scope and no
by ikegami
in thread Redefining Imported Subs: of scope and no
by temporal
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |