#!/usr/bin/perl -w
# This file is part of MySQLDumper released under the GNU/GPL 2 license
# http://www.mysqldumper.net
# @package MySQLDumper
# @version $Rev: 1351 $
# @author $Author: jtietz $
# @lastmodified $Date: 2011-01-16 20:55:42 +0100 (So, 16. Jan 2011) $
# @filesource $URL: https://mysqldumper.svn.sourceforge.net/svnroot/mysqldumper/branches/msd1.24.3/msd_cron/perltest.pl $
use strict;
use Socket;
use Config;
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
use CGI;
warningsToBrowser(1); # dies ist ganz wichtig!
my $eval_in_died;
my $mod_dbi=0;
my $mod_ff=0;
my $mod_fb=0;
my $mod_gz=0;
my $mod_ftp=0;
my $mod_mime=0;
my $mod_ftpssl=0;
my $dbi_driver;
my $dbi_mysql_exists=0;
my $get_options=0;
my $ok='';
my $err='';
my $zlib_version='unknown';
my $cgi = CGI->new();
print $cgi->header(-type => 'text/html; charset=utf-8', -cache_control => 'no-cache, no-store, must-revalidate');
print "\n";
print "Testing needed Perl-Moduls in order to run the Perl script crondump.pl
\n";
print "Necessary Modules for crondump.pl
";
print "testing DBI ...\n";
eval { $eval_in_died = 1; require DBI; };
if(!$@){
$mod_dbi = 1;
import DBI;
}
if($mod_dbi!=1){
print $err."
Couldn't find DBI!
crondump.pl can't establish a connection to the MySQL database!\n";
} else {
print $ok."Found modul DBI. OK.\n";
my @available_drivers = DBI->available_drivers('quiet');
foreach $dbi_driver (@available_drivers)
{
print "
Found modul DBI::$dbi_driver\n";
if ( $dbi_driver eq 'mysql' ) { $dbi_mysql_exists=1; } ;
}
if ($dbi_mysql_exists !=1 ) { print $err."
Critical error: modul DBI::mysql not found! crondump.pl can't establish a connection to the MySQL-Database if this modul isn't installed! Please install DBI::mysql!"; }
else { print "
".$ok."Found modul DBI::mysql. OK. crondump.pl can connect to MySQL-Database."; }
}
print "
testing File::Find ...\n";
eval { $eval_in_died = 1; require File::Find; };
if(!$@){
$mod_ff = 1;
import File::Find;
}
if($mod_ff!=1){
print $err."Critical error: modul File::Find not found! Please install it
\n";
} else {
print $ok."Found modul File::Find. OK.
\n";
}
print "testing File::Basename ...\n";
eval { $eval_in_died = 1; require File::Basename; };
if(!$@){
$mod_fb = 1;
import File::Basename;
}
if($mod_fb!=1){
print $err."Critical error: modul File::Basename not found! Please install it!
\n";
} else {
print $ok."Found modul File::Basename. OK.
\n";
}
print "testing Getop...\n";
eval { $eval_in_died = 1; require Getopt::Long; };
if(!$@){
$get_options = 1;
import Getopt::Long;
}
if($get_options!=1){
print $err."Modul Getopt not found! You should install it if you want to set configfile via shell.
\n";
} else {
print $ok."Found modul Getopt. OK. crondump.pl can read configfile-parameter from shell.
\n";
}
print "