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

Re^3: constants wont optimize

by chromatic (Archbishop)
on Jul 11, 2011 at 05:13 UTC ( #913654=note: print w/replies, xml ) Need Help??

in reply to Re^2: constants wont optimize
in thread constants wont optimize

The fix is to throw another BEGIN around the part that sets the constant. I would like to know why it works.

eval is a runtime operation. Sub declaration is a compile time operation. BEGIN does nothing to change that unless you use a BEGIN to perform the runtime eval before the compile time declaration occurs.

All of the operations within a single BEGIN block occur, with respect to each other, in the order they would occur if not for the BEGIN block.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://913654]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (15)
As of 2018-06-22 15:29 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (124 votes). Check out past polls.