Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Core module: Attribute::Handlers behaviour

by moritz (Cardinal)
on Oct 20, 2012 at 07:11 UTC ( #1000107=note: print w/replies, xml ) Need Help??


in reply to Core module: Attribute::Handlers behaviour

As a clarification, if you write
use Attribute::Handlers; sub TRACE :ATTR(CODE) { ... }

Then your sub TRACE will be called once if you write

sub mysub :TRACE { }

but it will not be called for each call of mysub.

So to achieve what you want, you have to write your TRACE function in a way that, if the appropriate configuration option is set, it wraps the function in a way that makes the tracing happen. Maybe Hook::LexWrap can be helpful for that purpose.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1000107]
help
Chatterbox?
[ambrus]: Corion: really? Does that mean the Prima watcher objects behave as handles that stop the watcher when they're destroyed, just like AnyEvent expects?
[ambrus]: "all the bugs" -- hehe, good luck
[ambrus]: Corion: what I don't understand is, if you make a one-shot AnyEvent timer with short timeout, does this code guarantee that the Prima timer can't queue two timeout events before invoking any of them?
[ambrus]: Because that could break AnyEvent code, which is why I added a guard.
[ambrus]: (It might be easier to use the callback scalar as a guard, as in $c and &$c(); $c = ();)

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2016-12-09 08:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (150 votes). Check out past polls.