in reply to Re^3: Removing CODE slot in typeglob / Reversing "use subs ...;"
in thread Removing CODE slot in typeglob / Reversing "use subs ...;"

It's the $false playing tricks again.

$::{FOO} is the typeglob for FOO in main, and a typeglob can be dereferenced as a hash, and that's exactly what $::{FOO}{CODE} does. It becomes more clear if you add the arrow: $::{FOO}->{CODE}. The reason it works without the arrow is that $::{FOO} is an element of the %:: hash, so it's no different than $foo{bar}{baz}.

use 5.010; our %FOO = (CODE => 'hash value'); say $::{FOO}{CODE}; __END__ hash value

lodin

Replies are listed 'Best First'.
Re^5: Removing CODE slot in typeglob / Reversing "use subs ...;"
by BrowserUk (Pope) on Jan 03, 2008 at 19:13 UTC
    It's the $false playing tricks again.

    Yeah. Evaling a conditional on an undefined variable in the absence of strict, is a weird way to test if something is allowed under strict.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      Doh!

      I'm so used to strict I didn't even think about that it's strict that makes barewords fatal. The root node is updated to have a (hopefully) correct test.

      No code is too short for strict ...

      lodin