develooper Front page | perl.perl5.porters | Postings from February 2003

overriding builtins quirk

Thread Next
From:
Jerrad Pierce
Date:
February 13, 2003 13:32
Subject:
overriding builtins quirk
Message ID:
3E4C0EDB.FD474AB1@mit.edu
I just stumbled across an (eh-hemm) interesting feature of package
scoped overriding
of builtins that doesn't seem to be documented. Maybe it doesn't need to
be, but it
took me awhile to track it down. Symbols exported into a package's
namespace within
a string eval make it out into the calling package except those that are
overriding
builtins.

if package Foo exports bar and stat

{
  eval "use Foo";
  bar(); #ok
  stat();#not ok, this is CORE::stat
}

only bar is exported


{
  eval q(use Foo;
  stat;  #ok);
  bar(); #ok
  stat();#not ok, this is CORE::stat
}

-- 
H4sICNoBwDoAA3NpZwA9jbsNwDAIRHumuC4NklvXTOD0KSJEnwU8fHz4Q8M9i3sGzkS7BBrm
OkCTwsycb4S3DloZuMIYeXpLFqw5LaMhXC2ymhreVXNWMw9YGuAYdfmAbwomoPSyFJuFn2x8
Opr8bBBidccAAAA=
--
MOTD on Prickle-Prickle, the 44th of Chaos, in the YOLD 3169:
Green potatoes and green potato chips are to be distinguished from brown
potato chips, which are another matter entirely.

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About