Hi, everyone, and thanks for reading.

I'm working on a little program that automatically generates an indented function call tree for a given program, and pulls out a one line description of each function called from the perldoc comments. (It pays to standardize your perldoc!) The idea is to present a quick overview of an entire program's calling hierarchy, without exposing too much detail at once.

I'm currently parsing the output of the B::Xref module to get the functions called, and then printing the tree.

My questions are:

1) Is there an easier (existing?) way to determine the function call stack, perhaps hidden somewhere in the B modules? I've looked through several, but I haven't made an exhaustive search. Suggestions would be appreciated.

2) Method calls are an interesting wrinkle in this whole design. The class name of an object would be a nice thing to print, along with the name of the method called.

However, the class of a given object is not guaranteed to be known at compile time.

This is a design issue that I've so far dealt with by ignoring it :-) Comments/suggestions are appreciated.

3) I can detect "dead code" in the form of subroutines that are never called, by subroutines) by looking at which subroutines are listed in the defintions section versus which are actually called. I'm really only interested in the functions within the main package, for now.

However, I'm not really interested in hearing about functions which were exported into the main package, and weren't used: I'm more interested in knowing which functions that were defined in the given *file* weren't ever called.

Short of playing games with a custom "Exporter" module, is there a way to determine which subroutines were exported into the main package, and which ones were not?

Any comments/suggestions/criticisms are welcome!

Thanks in advance,

-- Ytreq Q. Uiop


In reply to Auto-generating annoted call trees by Ytrew

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.