Apache-SessionManager

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

# Allow us to skip prompt and (and for) tests
use Getopt::Std qw(getopts);
use vars qw($opt_n);
getopts('n');

#unless (getopts("n")) {
#    die "Usage: $0 [-n]\n";
#}   

my($errors, $warnings);
my $necessary_modules = {
#	'Apache' => 'The Apache Perl API',
	'Apache::Session 1.54' => 'A persistence framework for session data'
};

my $optional_modules = {
	'Apache::Request 0.33' => 'Apache API to manage HTTP cookies (CGI::Cookie will be used instead)',
	'CGI::Cookie' => 'CGI library to manage HTTP cookies (used only if Apache::Request isn\'t installed)'
};

print "Checking for REQUIRED modules...\n";

# Check mod_perl version
my ($mp1,$mp2) = which_mod_perl();
print " --> mod_perl... ";
if ( ! $mp1 && ! $mp2 ) {
	$errors++;
	print "NOT FOUND\n";
	print "     !!! Please install either mod_perl (version 1 or 2) in order to use Apache::SessionMananger!\n";
}
else {
	print 'found (version 1: ' . (($mp1) ? $mp1 : 'none') . ', version 2: ' . (($mp2) ? $mp2 : 'none') . ")\n";
}

for (sort keys %$necessary_modules) {
	eval 'use ' . $_ ;
	my $module_display = $_;
	$module_display =~ s/( [\d\.]+)$/ \>\=$1/isg;
	print " --> $module_display... ";
	if ($@) {
		$errors++;
		print "NOT FOUND\n";
		print "     !!! you need module: $module_display\n";
		print "         CAUSE: $necessary_modules->{$_}\n";
	}
	else {
		print "found.\n";
	}
}

print "\nChecking for OPTIONAL modules...\n";
for (sort keys %$optional_modules) {
	my $data = $optional_modules->{$_};
	my $message = ref($data) ? $data->{message} : $data;

	# if there is a test for this module run it and if returns false
	# skip this module's message, first so UNIX users don't see 
	# message about, ad ex., Win32::OLE
	if (ref($data) && $data->{test} && ! eval($data->{test})) {
		next;
	}

	{
		local $SIG{__DIE__} = sub { die(@_); };
		eval 'use ' . $_ ;
		my $module_display = $_;
		$module_display =~ s/( [\d\.]+)$/ \>\=$1/isg;
		print " --> $module_display... ";
		if ($@) {
			$warnings++;
			print "NOT FOUND\n";
			print "     ??? you may need module: $module_display\n";
			print "         CAUSE: $optional_modules->{$_}\n";



( run in 0.480 second using v1.01-cache-2.11-cpan-df04353d9ac )