hi,lists, I have seen this thread on perlmonk,and it make me confused too.Can anyone here explain that?Thanks.
Quote: ------- Basically, deleting subroutines from a symbol table seems a bit buggy, but I don't know if this behavior is documented or not. #!/usr/bin/perl -l sub this { 'this' } print this; undef &main::this; # undefine the code slot print main->can('this') ? 'main->can("this")' : '! main->can("this")'; eval {print this}; print $@; undef *main::this; # undefine the entire glob print main->can('this') ? 'main->can("this")' : '! main->can("this")'; __END__ # result this main->can("this") Undefined subroutine &main::this called at sub.pl line 7. ! main->can("this") The first time I try to remove the subroutine via undef it still leaves a CODE slot in the symbol table's *this glob. I can't just use delete because it's not an array or a hash (it fails if you try). This is bad in procedural code but it's awful in OO code because $object->can('this') will succeed even if the method has been deleted. This leaves me with having to undefine the entire glob but that's a horrible solution because the other slots in the glob, if any, are blown away. Is this a known/documented bug/feature in Perl? Is there a workaround? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>