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

overriding builtins quirk

Thread Next
Jerrad Pierce
February 13, 2003 13:32
overriding builtins quirk
Message ID:
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

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

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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About