morgon has asked for the wisdom of the Perl Monks concerning the following question:
can someone explain to me what is happening in CORE::GLOBAL for mere curiosity...
If I do e.g.
it seems CORE::GLOBAL::sleep is a code-ref, yetperl -e 'print \&CORE::GLOBAL::sleep' CODE(0x563c8adc73e0)
I cannot call it directly. Even weirder isperl -e '&CORE::GLOBAL::sleep(1)' Undefined subroutine &CORE::GLOBAL::sleep called at -e line 1.
so it seems every arbitary code-slot in CORE::GLOBAL is (virtually) filled with the same code-ref that probably points to some interception logic but I am surprised that there are code-refs that cannot be called...perl -e 'print \&CORE::GLOBAL::hubbabubba' CODE(0x561b6472f3e0)/
I am aware that CORE::GLOBAL is for allowing built-ins to be redefined but this surprises me...
Can anybody with some knowlege of the internals shed some light on this?
Many thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CORE::GLOBAL magic?
by NetWallah (Canon) on Jun 02, 2018 at 05:07 UTC | |
by Anonymous Monk on Jun 02, 2018 at 12:49 UTC | |
by LanX (Saint) on Jun 02, 2018 at 16:10 UTC | |
|
Re: CORE::GLOBAL magic?
by kcott (Archbishop) on Jun 02, 2018 at 02:39 UTC | |
|
Re: CORE::GLOBAL magic?
by Veltro (Hermit) on Jun 02, 2018 at 13:56 UTC |