Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Hmm, not sure this is going to be useful for you.

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

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-20 01:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found