[Cedarvalley] Checking for a module before loading.

Aaron Thompson thompson at cns.uni.edu
Thu Feb 5 16:13:13 CST 2004


Cool I'll look into these, thanks.

@

On Thu, Feb 05, 2004 at 04:09:50PM -0600, Stephen D. Wells wrote:
> Look at the test scripts for Net::DNS..
> 
> ----------------------------
> use Test::More tests => 73;
> use strict;
>  
> BEGIN {
>     use_ok('Net::DNS');
>     use_ok('Net::DNS::Resolver::Recurse');
>     use_ok('Net::DNS::Nameserver');
> ---------------------------
> 
> it tests whether or not it can load the module...
> 
> However...
> 
> Module::Load::Conditional
> 
> might prove more interesting...
> 
> HTH,
> STEVE
> 
> On Thu, 2004-02-05 at 15:01, Aaron Thompson wrote:
> > Hello,
> > 
> >   I was wondering if anyone knew of a good way to check for a
> >   perl module before loading it.
> > 
> >   Something like:
> >     use Net::SMTP if (is_module(Net::SMTP));
> > 
> >   I would like to write some code that will check if modules are
> >   present and then load them.
> > 
> >   Thanks.
> > 
> >   @
> -- 
> Stephen D. Wells <wells at cedarnet.org>

-- 
Aaron Thompson   Unix Systems Administrator, College of Natural Science
http://www.cns.uni.edu/~thompson/           University of Northern Iowa

"Because as we know, there are known knowns, there are things we know we
know. We also know there are known unknowns; that is to say we know there are
some things we do not know. But there are also unknown unknowns - the ones we
don't know we don't know." - Donald Rumsfeld



More information about the Cedarvalley mailing list