http://www.perlmonks.org?node_id=378941

BrowserUk has asked for the wisdom of the Perl Monks concerning the following question:

Is there any way to arrange for a callback to program level code as a running program crosses package boundaries?

I'd like to be able to have a subroutine in my module that gets called whenever the running program calls a function or method within the scope of that package, and perhaps another as it exits.

I can't even begin to see a way to do this, but then are are a lot of things in the Devel::* group of modules that do stuff with introspection that I wouldn't have thought possible had I not seen them in action.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
"Memory, processor, disk in that order on the hardware side. Algorithm, algoritm, algorithm on the code side." - tachyon