Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
Problems? Is your data what you think it is?
 
PerlMonks  

Re: eval('__PACKAGE__') is always main?!!!

by ikegami (Pope)
on Dec 23, 2004 at 21:09 UTC ( #417210=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub moo { print("moooooain\n"); }
    package cow;
    sub moo { print("moooOoooOOoooo\n"); }  # <--- prints this
    eval 'moo();';
    
  2. or download this
    > echo "print(__PACKAGE__, $/);" > script.pl
    > perl -e "package foo; do 'script.pl';"
    main
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2014-04-19 20:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (483 votes), past polls