Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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

by gaal (Parson)
on Dec 24, 2004 at 07:01 UTC ( #417269=note: print w/replies, xml ) Need Help??


in reply to Re: eval('__PACKAGE__') is always main?!!!
in thread eval('__PACKAGE__') is always main?!!!

(Following up on a brief CB /msg exchange, that may be interesting to other monks.)

Speaking of documentation only here: I thought "executed within the context of the current Perl program" ought to have trumped eval EXPR's move to main, but as ikegami notes, the statement about context applies only to eval BLOCK.

But eval BLOCK of course does share some (a lot of) state with the main program; there's no new perl interpreter constructed, and the following does change the value of $x in the main program:

perl -le '$x = 42; eval q($x = 6*9); print $x'    # prints "54"

The first thing that needs fixing in this case appears to be the docs.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://417269]
help
Chatterbox?
[ambrus]: pryrt: yes, there is. link "Your votes" from your profile page.
[ambrus]: (That link work two ways: from your own profile page, it lists all your votes; from anyone else's profile page, it lists your votes on that user's nodes only.)
[choroba]: Wow, and I can create an interesting statistics from it
[LanX]: I've also added a link "my votes" to the personal nodelet
[pryrt]: Thanks, that was what I was looking for

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2017-03-29 13:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (351 votes). Check out past polls.