File: //proc/self/root/scripts.20110531.215904.25158/cpcpan_check_installed
#!/usr/bin/perl
# cpanel12 - cpcpan_check_installed Copyright(c) 1997-2008 cPanel, Inc.
# All rights Reserved.
# copyright@cpanel.net http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
#
eval "use Encode;";
my $hasencode = $@ ? 0 : 1;
if ( !$hasencode ) {
unshift @INC, '/usr/local/cpanel/Cpanel/CPAN/stubs/Encode';
eval "use Encode;";
}
my $module = $ARGV[0];
if ( $module eq 'Term::ReadLine::Perl' ) {
eval 'use Term::ReadLine;';
}
my $hasmodule = 0;
if ( $module !~ /^Bundle::/i ) {
#Net::SSLeay and Authen::Libwrap and Scalar::Util are special cases
if ( $module eq 'Authen::Libwrap' ) {
system '/scripts/patch_authen_libwrap';
}
elsif ( $module eq 'Net::SSLeay' ) {
require Net::SSLeay;
import Net::SSLeay;
Net::SSLeay::load_error_strings();
Net::SSLeay::OpenSSL_add_ssl_algorithms();
Net::SSLeay::randomize();
}
elsif ( $module eq 'Scalar::Util' ) {
eval 'use Scalar::Util qw(dualvar weaken isweak);';
}
else {
eval "use $module;";
}
$hasmodule = $@ ? 0 : 1;
}
else {
$hasmodule = 1;
}
if ($hasmodule) {
print "$module is installed.\n";
print "version=" . eval( '$' . $module . '::VERSION' ) . "\n";
exit(0);
}
else {
print "$module is not installed or broken (make sure not to trap this message, you should check for /$module is installed/ as this message might not show if there is a symbol/object error).\n";
open( PERL, "|/usr/bin/perl" );
print PERL "use $module;\n";
close(PERL);
}
exit(1);