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

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

by ikegami (Patriarch)
on Dec 23, 2004 at 21:09 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://417210]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-04-23 11:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found