in reply to Re: __PACKAGE__ interpolated before inheritence
in thread __PACKAGE__ interpolated before inheritence

Not always but close enough :) I'm confused why __PACKAGE__ wont work.

Greetz
Beatnik
... Quidquid perl dictum sit, altum viditur.

Replies are listed 'Best First'.
Re: Re: Re: __PACKAGE__ interpolated before inheritence
by wog (Curate) on Dec 08, 2001 at 19:45 UTC
    __PACKAGE__ is turned into, at compile time, the current package when it is compiled. (That is, the one established by package statements.)
      To see this in action:
      % perl -MO=Deparse -e 'use constant Y => "foo"; $x="bar"; return __PAC +KAGE__, $x, Y' sub Y () { package constant; $scalar; } $x = 'bar'; return 'main', $x, 'foo'; # <=== inlined values at compile time...
      Notice that __PACKAGE__ and the constant Y got inlined at compile time, whereas $x did not.

      -Blake