Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Just to be clear - you can not generically get a list of modules that the app depends on by code analysis alone. E.g. if your apps does <code>eval { require $module; $module-&gt;import() }</code>, where <code>$module</code> is passed via command line, then this can ONLY be detected by actually running the specific command line version with ALL the module values. </p> <p>If you do wish to do this, you can figure out every module used by a combination of runs via:</p> <ol> <li><p><code>Devel::Cover</code>. Coverage reports would list 100% of modules used. But you don't get version #s.</p></li> <li><p>Print <code>%INC</code> at <strong>every single possible exit point</strong> in the code as slu's answer said. This should probably be done in <code>END{}</code> block as well as <code>__DIE__</code> handler to cover all possible exit points, and even then may be not fully 100% covering in generic case if somewhere within the program your <code>__DIE__</code> handler gets overwritten.</p></li> <li><p><code>Devel::Modlist</code> (also mentioned by slu's answer) - the downside compared to <code>Devel::Cover</code> is that it does NOT seem to be able to aggregate a database across multiple sample runs like <code>Devel::Cover</code> does. On the plus side, it's purpose-built, so has a lot of very useful options (CPAN paths, versions).</p></li> <li><p>Please note that the other module (<code>Module::ScanDeps</code>) does NOT seem to allow you to do runtime analysis based on arbitrary command line arguments (e.g. it seems at first glance to only allow you to execute the program with no arguments) and if that's true, is inferior to all the above 3 methods for any code that may possibly load modules dynamically.</p></li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload