Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
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?
[jedikaiti]: If I had a flying home, I'd be pretty psyched. How cool would that be?
[jedikaiti]: The big question is, does it have autopilot?
[shmem]: good autonomous flyer doesn't need a pilot.
[karlgoethebier]: The One And Only Flying Home

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (9)
As of 2018-02-21 17:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (285 votes). Check out past polls.

    Notices?