Hi,

can someone explain to me what is happening in CORE::GLOBAL for mere curiosity...

If I do e.g.

perl -e 'print \&CORE::GLOBAL::sleep' CODE(0x563c8adc73e0)
it seems CORE::GLOBAL::sleep is a code-ref, yet
perl -e '&CORE::GLOBAL::sleep(1)' Undefined subroutine &CORE::GLOBAL::sleep called at -e line 1.
I cannot call it directly. Even weirder is
perl -e 'print \&CORE::GLOBAL::hubbabubba' CODE(0x561b6472f3e0)/
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...

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!


In reply to CORE::GLOBAL magic? by morgon

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.