Just another Perl shrine | |
PerlMonks |
Auto-generating annoted call treesby Ytrew (Pilgrim) |
on Sep 13, 2004 at 17:11 UTC ( [id://390609]=perlquestion: print w/replies, xml ) | Need Help?? |
Ytrew has asked for the wisdom of the Perl Monks concerning the following question:
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
Back to
Seekers of Perl Wisdom
|
|