Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Re: Re: __PACKAGE__ interpolated before inheritence

by wog (Curate)
on Dec 08, 2001 at 19:45 UTC ( #130421=note: print w/replies, xml ) Need Help??


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

__PACKAGE__ is turned into, at compile time, the current package when it is compiled. (That is, the one established by package statements.)

Replies are listed 'Best First'.
Re4: __PACKAGE__ interpolated before inheritence
by blakem (Monsignor) on Dec 09, 2001 at 01:44 UTC
    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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://130421]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2022-12-03 20:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?