Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Is this a pure Perl module with no other dependencies?</p> <p>I'd just package it with my code. Heck, you can even just append it to your file, if you prefer.</p> <p>If this is a bit more complex, that is, there are a dozen of required modules that must be installed, and there is some compilation that is required, you'll have to use CPAN to download it. There is a <a href="http://search.cpan.org/~dons/CPAN-AutoINC-0.01/AutoINC.pm" rel="nofollow">CPAN::AutoINC</a> which is suppose to download and install any modules you need from CPAN when the module is required and not in the <code>@INC</code> path.</p> <p>However, my experience has been that you end up with a mess 'o worms. A user might start to run your program thinking it'll run for a a minute only to discover that they're spending 20 minutes downloading, compiling, and testing prerequisite modules when they really don't have time.</p> <p>It's better just to fail, and give a good explanation of what is required. The user might prefer to run <code>cpan</code> as root, so it's available for everyone on the machine. Or, maybe they need to ask a system admin to do it for them.</p> <p>I've found I can do something like this:</p> <pre><code>our $missingModuleFlag; BEGIN { eval { require My::Mod; }; our $missingModuleFlag = $@ if ($@); } [...] our $missingModuleFlag; #Package Variable -- Value is from above if ($missingModuleFlag) { die &lt;&lt;EOM; ERROR: You are missing module "My::Mod" which is required for this program. Please use "cpan" to download this module and install it on this server. If you have no idea what I am talking about, see http://www.cpan.org/modules/INSTALL.html. If that doesn't make any sense to you, then ask a system administrator. EOM } </code></pre> <p>It explains what is the issue, and what needs to be done and gives the user a choice to either go ahead with the install, or ask someone else to do it for them.</p>
 

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