| 1 |
#!perl |
| 2 |
|
| 3 |
use strict; |
| 4 |
use warnings; |
| 5 |
|
| 6 |
|
| 7 |
my $runner = Apache::TestRunPerl::Custom->new()->run(@ARGV); |
| 8 |
|
| 9 |
# The custom module |
| 10 |
package Apache::TestRunPerl::Custom; |
| 11 |
|
| 12 |
use base qw(Apache::TestRunPerl); |
| 13 |
|
| 14 |
use File::Spec; |
| 15 |
use IO::File; |
| 16 |
|
| 17 |
|
| 18 |
sub configure |
| 19 |
{ |
| 20 |
my $self = shift; |
| 21 |
|
| 22 |
my $conf_file = $self->_conf_file(); |
| 23 |
my $skip_file = File::Spec->catfile( $self->{test_config}{vars}{t_conf}, 'skip' ); |
| 24 |
|
| 25 |
for my $file ( $conf_file, $skip_file ) |
| 26 |
{ |
| 27 |
if ( -f $file ) |
| 28 |
{ |
| 29 |
unlink $file |
| 30 |
or die "Cannot unlink $file: $!"; |
| 31 |
} |
| 32 |
} |
| 33 |
|
| 34 |
$self->SUPER::configure(@_); |
| 35 |
|
| 36 |
if ( $self->{test_config}{server}{rev} >= 2 ) |
| 37 |
{ |
| 38 |
my $apreq2 = $self->{test_config}->find_apache_module('mod_apreq2.so'); |
| 39 |
|
| 40 |
if ($apreq2) |
| 41 |
{ |
| 42 |
$self->_write_apreq_conf( "LoadModule apreq_module $apreq2" ); |
| 43 |
} |
| 44 |
else |
| 45 |
{ |
| 46 |
$self->_write_apreq_conf(''); |
| 47 |
open my $fh, '>', $skip_file |
| 48 |
or die "Cannot write to $skip_file: $!"; |
| 49 |
} |
| 50 |
} |
| 51 |
else |
| 52 |
{ |
| 53 |
$self->_write_apreq_conf(''); |
| 54 |
} |
| 55 |
} |
| 56 |
|
| 57 |
sub _conf_file { File::Spec->catfile( $_[0]->{test_config}{vars}{t_conf}, 'apreq2.conf' ) } |
| 58 |
|
| 59 |
sub _write_apreq_conf |
| 60 |
{ |
| 61 |
my $self = shift; |
| 62 |
my $content = shift; |
| 63 |
|
| 64 |
my $conf_file = $self->_conf_file(); |
| 65 |
|
| 66 |
open my $fh, '>', $conf_file |
| 67 |
or die "Cannot write to $conf_file: $!"; |
| 68 |
print $fh $content . "\n" |
| 69 |
or die "Cannot write to $conf_file: $!"; |
| 70 |
close $fh |
| 71 |
or die "Cannot write to $conf_file: $!"; |
| 72 |
} |
| 73 |
|
| 74 |
|
| 75 |
1; |