Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: Analyzing Perl Code

by BrowserUk (Pope)
on Sep 19, 2012 at 23:02 UTC ( #994558=note: print w/replies, xml ) Need Help??

in reply to Analyzing Perl Code

Put the following code in a file called: /yourperl/site/Devel/

package Devel::Calls; our $lastsub; sub DB::DB { my( $p, $f, $l, $sub ) = caller(1); return if $lastsub and $sub eq $lastsub; printf STDERR "%s(%u): %s()\n", $f//'unknown', $l//'0', $sub//'unknown', $lastsub = $sub; return; } 1;

And then invoke your scripts with perl -d:Calls

You'll get a trace showing file, line and subroutine name whenever a subroutine is entered, something like:

C:\test>perl -d:Calls 1 2 3 unknown(0): unknown() main::aaa() main::bbb() main::ccc() main::ddd() main::eee() main::fff() main::ggg() main::hhh() main::iii() main::jjj() main::kkk() main::lll() main::mmm() main::nnn() main::ooo() main::ppp() main::qqq() main::rrr() main::sss() main::ttt() main::uuu() main::vvv() main::www() main::xxx() main::yyy() main::zzz() 234

That could obviously be greatly extended, but it may be just what you're looking for.

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.

RIP Neil Armstrong

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://994558]
[shmem]: karlgoethebier: es ist theologisch umstritten, ob jesus an christi himmelfahrt tatsächlich besoffen und mit bollerwagen zu seinem vater aufgebrochen ist
[karlgoethebier]: shmem: Ja ischweis
[karlgoethebier]: shmem: Vielleicht hat er in den Bollerwagen gebrochen?
[karlgoethebier]: shmem:Ach so. Bollerwagen ist eigentlich was für Kinder. Bei uns fahren sie mit Traktoren und Feuerwehrwagen rum...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (11)
As of 2017-05-25 12:37 GMT
Find Nodes?
    Voting Booth?