SPUG: must dumpvar.pl be required BEGIN

DeRykus, Charles E charles.e.derykus at boeing.com
Thu Apr 2 14:39:51 PDT 2009


From: Jacinta Richardson [mailto:jarich at perltraining.com.au] 
> Files which are required are rarely modules.  Require isn't very
common these days, 
> as making modules is usually better.  For example you just need to
create a package 
> of the same name as your file, use Exporter and @EXPORT_OK if you want
> functionality and "use" it instead of requiring.  For examp

One of the minor runtime benefits of 'require' is conditional 
module loading although I'm sure you can do the same thing with 
the 'autouse' pragma. 

if ($debug) { 
  require LWP::Debug; LWP::Debug->import('+');

Speaking of LWP,  the UserAgent example still seems to use require 
for some reason - rational or not:

       LWP::UserAgent - Web user agent class

        require LWP::UserAgent;

        my $ua = LWP::UserAgent->new;

Charles DeRykus

More information about the spug-list mailing list