[Thamesvalley-pm] checking for perl modules

Greg Matthews gmatt at nerc.ac.uk
Fri Jun 13 05:20:12 PDT 2008


Will Hawes wrote:
> Not something I've ever done, but you could probably do something like
> (untested, btw):

thanks Will, I'll give it a crack.

G

> 
> #!/usr/bin/perl
> 
> BEGIN {
>   my @required_modules = ( qw/ Module1 Module2 / );
>   foreach( @required_modules ) {
>     eval { require "$_"; };
>     if( $@ ) {
>       die "You don't appear to have module '$_' installed on your system.";
>     }
>   }
> }
> 
> ... rest of script here ...
> 
> HTH, Will
> _______________________________________________
> Thamesvalley-pm mailing list
> Thamesvalley-pm at pm.org
> http://mail.pm.org/mailman/listinfo/thamesvalley-pm
> 


-- 
Greg Matthews           01491 692445
Head of UNIX/Linux, iTSS Wallingford

-- 
This message (and any attachments) is for the recipient only. NERC
is subject to the Freedom of Information Act 2000 and the contents
of this email and any reply you make may be disclosed by NERC unless
it is exempt from release under the Act. Any material supplied to
NERC may be stored in an electronic records management system.



More information about the Thamesvalley-pm mailing list