Dan Anderson wrote:

> How can I tell whether or not a module exists, and what version it is?
> i.e. do something like if (defined CGI.pm).  I want to make sure all my
> users are running off of the same modules.

during runtime or when you preparing to install your module?  something 
along the line should do it:

#!/usr/bin/perl -w
use strict;

#--
#-- you might not want that and decided to check
#-- version yourself after a successful load.
#--
eval "use $ARGV[0] $ARGV[1]";

if($@){
        print STDERR $@;
}else{
        print "$ARGV[0] v$ARGV[1]\n";
}

__END__

success:

[panda]# has_module.pl Date::Manip 5.4
Date::Manip v5.4

wrong version:

[panda]# has_module.pl Date::Manip 6.4
Date::Manip version 6.4 required--this is only version 5.40 at (eval 2) line 
2. BEGIN failed--compilation aborted at (eval 2) line 2.

missing module:

[panda]# has_module.pl perl 0
Can't locate perl.pm in @INC ... etc

david
-- 
$_=q,015001450154015401570040016701570162015401440041,,*,=*|=*_,split+local$";
map{~$_&1&&{$,<<=1,[EMAIL PROTECTED]||3])=>~}}0..s~.~~g-1;*_=*#,

goto=>print+eval

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to