Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Constant redefined

by salva (Canon)
on May 31, 2005 at 11:35 UTC ( [id://462001]=note: print w/replies, xml ) Need Help??


in reply to Constant redefined

I have not been able to test it, but maybe this would work:
use constant foo => 1; BEGIN { undef &foo } use constant foo => 2;

update: well, it silences the original warning but causes a new one related to changed prototypes.

Replies are listed 'Best First'.
Re^2: Constant redefined
by salva (Canon) on May 31, 2005 at 13:54 UTC
    this actually works:
    use warnings; use constant foo => 10; BEGIN { no warnings; undef &foo; *foo = sub () {20} }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2025-03-27 00:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When you first encountered Perl, which feature amazed you the most?










    Results (68 votes). Check out past polls.

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.