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$..$/
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|