![]() |
|
"be consistent" | |
PerlMonks |
Re: Constant redefinedby davido (Cardinal) |
on May 31, 2005 at 04:30 UTC ( [id://461920]=note: print w/replies, xml ) | Need Help?? |
The answer to this question is found in constant (the documentation for the constant pragma), where it states:
That statement means that constants are both declared at, and solidified at compiletime, and cannot be altered. You would literally have to go back and alter all the inlined values in the compiled code at runtime. Constants are...constant. ;) The fact that constants are translated into inline values instead of the subroutine calls that they "look" like means that even if you tried to assign a new subroutine to the typeglob by which the constant is named, you can't. The typeglob for the sub seems to be forever tied to that inlined value. Of course if you read on in the docs to the BUGS section you'll find the following:
Exploiting that bug should not be for the faint of heart. In fact, exploiting it should just not ever be done, because its possible the behavior will go away if someone decides to fix that bug. Dave
In Section
Seekers of Perl Wisdom
|
|