how do I create self aware functions

2003-11-18 Thread Dan Anderson
Is it possible to create self aware functions (possibly using a magic variable)? I.e. functions that know their own name. Sort of the oppossite of bless. Basically, I want to create functions like: sub foo { my $self = shift (@_); my $name = decode_blessing ($self); } Does that

Re: how do I create self aware functions

2003-11-18 Thread James Edward Gray II
On Nov 18, 2003, at 4:23 PM, Dan Anderson wrote: Is it possible to create self aware functions (possibly using a magic variable)? I.e. functions that know their own name. Sort of the oppossite of bless. You're looking for ref(), but first let me give you the This is often a bad idea warning.

Re: how do I create self aware functions

2003-11-18 Thread Dan Anderson
You're looking for ref(), but first let me give you the This is often a bad idea warning. What are you trying to use the object's name for? Debugging. I have a function that writes errors / warnings / errata to logs. Sometimes it could be more transparent if I included things like

Re: how do I create self aware functions

2003-11-18 Thread drieux
On Tuesday, Nov 18, 2003, at 14:27 US/Pacific, James Edward Gray II wrote: On Nov 18, 2003, at 4:23 PM, Dan Anderson wrote: Is it possible to create self aware functions (possibly using a magic variable)? I.e. functions that know their own name. Sort of the oppossite of bless. You're looking

Re: how do I create self aware functions

2003-11-18 Thread Todd W.
Dan Anderson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] You're looking for ref(), but first let me give you the This is often a bad idea warning. What are you trying to use the object's name for? Debugging. I have a function that writes errors / warnings / errata to logs.