Along similar lines to the reply by planetscape, here is a (rather old) tool that might be able to do some of what you want:

Tabulate sub defs, sub calls in Perl code

It just looks for (and lists) the creation of subroutines, and within each one (and in "main") it looks for (and lists) subs that are called.

As for your other goals: You might be able to look at my example, or others suggested above, and work out a way to run diffs in some appropriate manner on pairs of subs, to list pairs that are mostly similar -- but the result has to be presented in some way that makes it easy to scan manually, because manual judgment will be needed here.

As for trying to identify and remove superfluous "use Some::Module" statements, I don't think it's worth the trouble -- these things are relatively harmless. If you have some sort of test harness for a script, such that you are sure every branch in the code is being exercised, you could try commenting out one "use" statement at a time and see which ones (if any) make no difference. But why bother? (If you don't have such a test harness, I would advise against this sort of approach.)


In reply to Re: Perl Analyzer? by graff
in thread Perl Analyzer? by Coldstone

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.