Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

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

by Corion (Pope)
on Dec 23, 2004 at 20:11 UTC ( #417200=note: print w/replies, xml ) Need Help??

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

You made a classic shell quoting error - use double quotes for the internal quotes:

perl -le 'package foo ;print eval("__PACKAGE__");'

or, when your shell only gives you one flavour of quote, use Perls superior quoting facilities:

perl -le 'package foo ;print eval(q(__PACKAGE__));'

Replies are listed 'Best First'.
Re^3: eval('__PACKAGE__') is always main?!!!
by gaal (Parson) on Dec 23, 2004 at 20:21 UTC
    Eek, you're right; the unquoted __PACKAGE__ of course comes from the un-evaled compile-time pass, and hence does say "foo".

    I can't find mention of this behavior in the docs (eval is where I'd like it to be), so yes, I'd consider this a bug.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://417200]
[choroba]: Rama!
[shmem]: hm. That should be "an artist's expression"
[RonW]: Happy Thanksgiving Eve
[RonW]: and no panic, here. We're staying home, safe from the frenzy in the stores

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (11)
As of 2017-11-22 16:50 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (327 votes). Check out past polls.