Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: undefing *foo{CODE} does not fully work

by liverpole (Monsignor)
on Oct 06, 2006 at 12:08 UTC ( #576650=note: print w/replies, xml ) Need Help??


in reply to undefing *foo{CODE} does not fully work

Posted to this site on September 9, 2005:
----------------------------------------------------------------- [Please enter your report here] This problem has been seen on Perl 5.8.3 and 5.8.7. I assume that it happens under other versions as well. If you try to undef the CODE slot of a glob, it only halfway works. ref(*foo{CODE}) will still show that it is a code reference, and UNIVERSAL::can still shows that it is a code reference. This bug causes problems when Apache::Reload and Class::DBI are used together. The following code sample demonstrates what I am talking about -------- #! /usr/bin/perl -l print "Originally foo() is a " . ref(*foo{CODE}); print "Initializing foo()"; *foo = sub {print "hello"}; print "foo() is now a " . ref(*foo{CODE}); print "According to can, foo is " . main->can("foo"); print "Calling foo()"; foo(); print "Undefining foo()"; $x = *foo; undef &$x; print "foo() is now a " . ref(*foo{CODE}); print "According to can, foo is " . main->can("foo"); print "Calling foo()"; foo(); __END__ Originally foo() is a Initializing foo() foo() is now a CODE According to can, foo is CODE(0x8175b24) Calling foo() hello Undefining foo() foo() is now a CODE According to can, foo is CODE(0x8175b24) Calling foo()

s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2017-11-18 17:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (277 votes). Check out past polls.

    Notices?