Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Re: Re: Re: Re: Re: Re: Short routines matter more in OO?

by tilly (Archbishop)
on Oct 15, 2003 at 02:45 UTC ( #299319=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: Re: Re: Re: Short routines matter more in OO?
in thread Short routines matter more in OO?

I would wonder whether Attribute::Property suffers from the same issue that came up at How to redefine subroutines with Attribute::Handlers that run at BEGIN time? (subsequently reported to p5p here). Namely that attribute wrapping of functions normally is done in INIT or CHECK blocks, but those are only run once in the lifetime of the interpreter.

Therefore code which is lazily loaded by do, require, AUTOLOAD, Apache::Reload etc won't have existed at the right time for the attributes to actually have been properly installed, therefore leading to mysteriously failing code.

Basically what I am saying is that attributes, while they certainly win on the "cool tricks" scale, are not something that I really want to depend on.

  • Comment on Re: Re: Re: Re: Re: Re: Re: Short routines matter more in OO?

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Re: Re: Re: Short routines matter more in OO?
by Juerd (Abbot) on Oct 15, 2003 at 06:44 UTC

    Therefore code which is lazily loaded by do, require, AUTOLOAD, Apache::Reload etc won't have existed at the right time for the attributes to actually have been properly installed, therefore leading to mysteriously failing code.

    Even though A::P does suffer from this, the bug caused by it is not mysterious. When you try to use the Property attribute on an anonymous sub or at some other time at which the symbol argument is not given, it croaks.

    I haven't needed to require or do my class modules or to autogenerate functions. Yet.

    Thank you for letting me know about this issue. I hope someone will find a workaround soon. When I have the time, I think I should try using Data::Swap and use the referent argument.

    Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2021-09-23 18:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?