Apache-SessionManager
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
print "\n***\n*** Required modules not founded!\n***\n";
print $CPAN,"\n";
}
elsif ($warnings) {
print $CPAN;
}
else {
print "\nRequired modules founded!\n";
}
# Check Apache / mod_perl test
my ($apache_Test,$apache_testold) = which_test_suite($mp1,$mp2);
# Skip test with -n command line option
unless ( $opt_n ) {
# Tests under Apache::Test are coming soon... :-)
if ( $mp2 || $apache_Test ) {
print "\n*** Sorry, Apache::Test has been detected, but there aren't (not yet) tests under this suite.";
}
# Run tests under Apache::testold
if ( $mp1 ) {
if ( ! $apache_testold ) {
print "\n*** Sorry, the mod_perl 1 version ($mp1) is too old to run Apache::testold tests.\n*** Please install a version >= 1.27 in order to run tests.";
}
else {
print "\n*** Configuring test under Apache::testold suite...\n";
print "*** Note that Apache::testold suite can run only under Apache 1.x/mod_perl 1.x\n";
# Currently, there is only Apache::testold tests :-(...
require Apache::testold;
my %params = Apache::testold->get_test_params();
Apache::testold->write_httpd_conf( %params, include => join('', <DATA>) );
*MY::test = sub { Apache::testold->MM_test(%params) };
}
}
print "\n\n";
}
else {
print "\n*** You've launched Makefile.PL with '-n' option. Tests will be skipped.\n\n";
}
use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
'NAME' => 'Apache::SessionManager',
'AUTHOR' => 'Enrico Sorcinelli <enrico@sorcinelli.it>',
'ABSTRACT' => 'Apache mod_perl module to manage HTTP sessions',
'VERSION_FROM' => 'SessionManager.pm', # finds $VERSION
'PREREQ_PM' => {
'mod_perl' => 1.24,
'Apache::Session' => 1.54,
#"Apache::Request" => "0.33",
}, # e.g., Module::Name => 1.1
'clean' => {FILES => 't/httpd.conf t/error_log t/httpd'},
);
sub which_mod_perl {
my ($mp1,$mp2);
# First, we check mod_perl version in standard dir
$mp1 = require_mod_perl();
# Check if mod_perl installed version is mp1 or mp2 generation
if ( $mp1 >= 1.99 ) {
$mp2 = $mp1;
$mp1 = 0;
}
# Check mp2 under Apache2 dir
else {
$mp2 = require_mod_perl(2);
}
return ($mp1,$mp2);
}
sub require_mod_perl {
my $mp = shift;
# Check mod_perl 2 under Apache2 dir
if ( $mp == 2 ) {
delete $INC{'mod_perl.pm'};
eval { require Apache2 };
return 0 if ($@);
}
eval { require mod_perl };
unless ($@) {
return $mod_perl::VERSION;
}
return 0;
}
sub which_test_suite {
my ($mp1,$mp2) = @_;
# default: no mod_perl at all
my ($apache_Test, $apache_testold) = (0,0);
if ( $mp1 ) {
$apache_testold = ($mp1 >= 1.28) ? 1 : 0;
eval { require Apache::Test };
$apache_Test = 1 unless ($@);
}
if ( $mp2 ) {
$apache_Test = 1;
}
return ($apache_Test, $apache_testold);
}
__DATA__
# Enable perl-status console
PerlModule Apache::Status
<Location /perl-status>
SetHandler perl-script
PerlHandler Apache::Status
</Location>
# Apache::SessionManager configuration section
PerlModule Apache::SessionManager
PerlTransHandler Apache::SessionManager
PerlSetVar SessionManagerTracking On
PerlSetVar SessionManagerDebug 5
# These documents require cookies session
<Location /session>
SetHandler perl-script
PerlHandler PrintEnv
PerlSetVar SessionManagerExpire 0
PerlSetVar SessionManagerStore File
PerlSetVar SessionManagerLock Null
PerlSetVar SessionManagerCookieArgs "Path => /session, Secure => 0, Extras => some_value"
PerlSetVar SessionManagerStoreArgs "Directory => /tmp"
PerlSetVar SessionManagerSetEnv On
</Location>
( run in 0.675 second using v1.01-cache-2.11-cpan-483215c6ad5 )