Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: Overwriting a Constant

by Anonymous Monk
on May 05, 2010 at 02:38 UTC ( [id://838435]=note: print w/replies, xml ) Need Help??


in reply to Re: Overwriting a Constant
in thread Overwriting a Constant

B::Deparse shows expansion
$ perl junk Constant subroutine A::VALUE redefined at junk line 12. Constant is 1 $ perl -MO=Deparse junk package A; sub BEGIN { require strict; do { 'strict'->import }; } use constant ('VALUE', 1); sub func { use strict 'refs'; print 'Constant is ', 1, "\n"; } package main; sub BEGIN { use strict 'refs'; require strict; do { 'strict'->import }; } *{'A::VALUE';} = sub () { 2 } ; 'A'->func; junk syntax OK
See, it shows     print 'Constant is ', 1, "\n"; not     print 'Constant is ', VALUE, "\n";

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://838435]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-03-28 16:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found