Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Using caller to determine the namespace of an anonymous subroutine

by chromatic (Archbishop)
on Feb 23, 2006 at 22:35 UTC ( [id://532409]=note: print w/replies, xml ) Need Help??


in reply to Using caller to determine the namespace of an anonymous subroutine

Perl Hacks has a tip from Ovid that shows how to get around this. Add one line of code to Creator::create():

*{$caller."::".$field} = sub { local *__ANON__ = "${caller}::${field}"; my $self = shift; return $self->STORE( $field, @_ ) if @_; return $self->FETCH( $field ); };

Replies are listed 'Best First'.
Re^2: Using caller to determine the namespace of an anonymous subroutine
by rrwo (Friar) on Feb 24, 2006 at 00:51 UTC

    Great idea. Thanks!

    (Now to patch Class::Accessor and related modules and convince the authors to accept the patches...)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://532409]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2025-06-13 14:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.