Very recently, I had to generate a dynamic tree of program calls. This is a proprietary language in which a program may call a subroutine (well, it's called a procedure in that language) or may call an external program written in the same language. What I needed was a full tree of all programs called by a certain subroutine of the main invoicing program, including programs called by the called programs.
All those programs are not Perl programs, but I used Perl to parse the main invoicing program and to recursively parse programs called by the main program.
Basically, my program first reads statically the program passed as a parameter and stores in a hash of arrays all the procedures of the program, with the name of the procedure as a key, and an anonymous array of the interesting code lines as a value. Once this is done, I'm doing a dynamic analysis of internal subs and and external programs called, so we have two levels of recursion here: one at the internal procedure call level (calling the procedure analysis sub) and one at the program level (calling the external program analysis sub).
I'm basically calling my program with a program name and a specific procedure name as argument, then reading the content of the procedure, and calling recursively either the procedure analysis sub or the external analysis sub.
I ended up with a 300+ line program generating a complete tree of function and external program calls. And that program generates a complete tree of procedure and external program calls for the input program and procedure.
I can't publish my program, but I could provide a pseudo-code example if you wish.
HTH.
In reply to Re: CPAN modules for inspecting a Perl distribution?
by Laurent_R
in thread CPAN modules for inspecting a Perl distribution?
by nysus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |