are you asking about what modules the program has loaded?

Then add just before MasterServer::run(); this line: use Data::Dumper; print Dumper(\%INC); . The (hashtable) variable %INC holds all the names of loaded packages (actually base-filenames) and their location on disk. Not to be confused with @INC which is the modules search path when loading modules by using use ... . Dumper() is a useful function for your purposes, it dumps the contents of complex variables, like hashtables. But it takes references to these variables (i.e. the use of \ in Dumper(\%INC))

Alternatively, find where the implementation of the method MasterServer::load_recursive is located (hint: it most likely is in a file called MasterServer.pm) and inject some print statements to see what's going on during execution.

Be warned that at various stages you may encounter an error message saying that a module, a package can not be found. That can actually be one of two problems: 1) this package does not exist in your system or 2) it does exist but perl can not find it because it is not in the @INC search path. Fix #1 by installing said module, like using a package manager (which you can install by cpan App::cpanminus;) using cpanm MyModule::XYZ or the already installed package manager cpan MyModule::XYZ . Fix #2 by adding more search-path-names to @INC, for example by adding use lib 'a-path-name'; at the beginning of your script.

By using print and print Dumper(\$some-variable) at strategic places in the script one will be able to get a sense of the code flow.

Also, in case you can't run this script and you are on a Unix/Linux system: find . -type f -iname '*.pm' will list all files ending in .pm or .PM in current dir and all its sub-dirs. If you can't run the program, getting the flow code is an exercise in meditation and zen.

edit: btw, there may be already a flag, a variable which turns logging and printing debugging messages ON. Keep an eye in case there is one.

edit: fixed a type in use Data::DumpER thanks to haukex

bw, bliako


In reply to Re^3: Code Flow by bliako
in thread Code Flow by CougarXR7

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.