Don't ask to ask, just ask | |
PerlMonks |
Re^2: Monkey patching all subs with a basic 'starting subname' messageby stevieb (Canon) |
on Jul 14, 2017 at 23:35 UTC ( [id://1195143]=note: print w/replies, xml ) | Need Help?? |
I responded on that thread, so I'll go another round. When I first started with Perl, I was dropped into a situation where I had a less-than-sane codebase. The very first thing I desired to design was something that could tell me stuff about code. I got familiar with the tools others have mentioned, but still wanted to figure it out. Devel::Trace::Subs was the creation of that, after having to go on another huge tangent with Devel::Examine::Subs as its backbone. This is intrusive; it literally writes to library files:
At this point, you've infected your ../Data/Dump.pm file. This is a global example, you can fine-tune what you're tracing. So a script that looked like this:
That output this:
...now looks like this:
... and outputs:
You can then just revert your changes:
The output is kind of configurable in that there are two very basic templates with the ability to send in an html flag for rendering. You can also limit the output to flow or trace. There are many other tools that do this kind of thing that are far better and far more widespread, and unless one is brave, they'd use a non-intrusive proper profiler or something that's been through the ropes. I just like how OP is proud of their __dbg() hijacker, so I thought I'd share :) update: Mentioned Devel::NYTProf as a profiler, but if OP wants to get into examining files/code itself, invest in learning some PPI.
In Section
Seekers of Perl Wisdom
|
|