Re: deprecated methods

[prev] [thread] [next] [Date index for 2004/11/29]

From: Dave Howorth
Subject: Re: deprecated methods
Date: 14:28 on 29 Nov 2004
I wrote:
 >>undef &fred;
 >>print "can=", __PACKAGE__->can('fred'), ";\n";
 >>produces:
 >>can=CODE(0x81199b4);

Yuval Kogman kindly replied:
> I think that something silly is happenning, that shouldn't be
> happenning.

> I'd ask why this is happenning on perlmonks, and then perlbug if
> there is no appearant reason.

and also gave some code that made it clear the symbol table entry still 
exists and that:

   undef *fred;

cleared that out.

I took his advice and asked on perlmonks and got a reply pointing to a 
discussion indicating that this behaviour is a, perhaps undesirable, 
side-effect of can giving useful answers in the presence of AUTOLOAD. 
The discussion is here:

http://groups.google.com/groups?hl=en&lr=&threadm=20040316222340.GY701%40plum.flirble.org&rnum=1&prev=/groups%3Fselm%3D20040316222340.GY701%2540plum.flirble.org

The perlmonk also mentioned that the thread gave the idiom:

   delete $::{'fred'}

to do what I wanted. I'm not familiar with the syntax, nor how to look 
something like that up, but it's less heavy-footed than undef *fred, so 
I'll use it :)

Thanks, Dave

deprecated methods
Dave Howorth 14:06 on 26 Nov 2004

Re: deprecated methods
Dave Howorth 17:25 on 26 Nov 2004

Re: deprecated methods
Yuval Kogman 18:35 on 26 Nov 2004

Re: deprecated methods
Dave Howorth 14:28 on 29 Nov 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52