"be consistent" | |
PerlMonks |
Re^2: Core module: Attribute::Handlers behaviourby BrowserUk (Patriarch) |
on Oct 20, 2012 at 16:20 UTC ( [id://1000139]=note: print w/replies, xml ) | Need Help?? |
Perl attributes are typically handled at CHECK time - between compile time (BEGIN) and INIT time, and way before run time. Your eval happens at run time, so too late to effect attribute processing. Hm. That doesn't ring true. Just because it is the main scripts runtime, doesn't prevent the eval use'd script from having its own BEGIN & END times. After all, it still has to be compiled. Given junk.pm:
This script that eval's it into being:
I get:
So, if the attribute handling can be done at BEGIN time, then it is quite simple to wrap the attributed function over in a wrapper that did the tracing, Tweak junk.pm above to be::
And main to be:
And you get:
which is kind of cool. (Shame the function name isn't provided to the attribute handler.) It'd be better if installing the TRACE attr into UNIVERSAL would then apply the wrappers to runtime loaded modules; and better yet if you you could use a "trace handler" package once in main and have it apply itself everywhere. With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
In Section
Seekers of Perl Wisdom
|
|