Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2017-12-13 05:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (345 votes). Check out past polls.

    Notices?