Apache-GeoIP
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
else {
ModPerl::MM::WriteMakefile(%opts);
}
#######################################################################
# The following routine assumes the existence of two subdirectories:
# Apache: for mod_perl-1 things
# Apache2: for mod_perl-2 things
# which_modperl() is called to determine which of the two
# directories to use, depending on availability of
# mod_perl and/or user input. The files under the
# chosen directory are then copied under the lib/ directory
# for subsequent installation. If there is a t/ directory
# under either Apache/ or Apache2/, the files under
# this directory are copied beneath the top-level t/.
#
# The routine returns a list containing two items - which
# of the directories (Apache or Apache2) is used, and also
# an array reference of files copied to the lib/ or t/ directories
#
########################################################################
sub mp_copy {
my $ans;
my $apache_dir = which_modperl();
@src_files = ();
my @dest_files = ();
finddepth(\&wanted, $apache_dir);
foreach my $src (@src_files) {
my $dir = dirname($src);
my $dest_dir;
if ($dir =~ m!/t/?(.*)!) {
$dest_dir = "t/$1";
}
else {
$dest_dir = 'lib/' . $dir;
}
unless (-d $dest_dir) {
mkpath($dest_dir, 1, 0755) or die "mkpath $dest_dir failed: $!";
}
my $base = basename($src);
my $dest_file = $dest_dir . '/' . $base;
push @dest_files, $dest_file;
my $key = $src;
copy($src, $dest_file) or die "Cannot copy $src to $dest_file: $!";
}
return ($apache_dir, \@dest_files);
}
sub wanted {
my $name = $File::Find::name;
not (-d $_ or $name =~ m!CVS|svn!i) and push @src_files, $name;
}
sub which_modperl {
my $ans;
eval {require mod_perl2;};
unless ($@) {
$ans = prompt('Install mod_perl-2 version?', 'yes');
return 'Apache2' if ($ans =~ /^y/);
}
eval {require Apache::src;};
unless ($@) {
$ans = prompt('Install mod_perl-1 version?', 'yes');
return 'Apache' if ($ans =~ /^y/);
}
warn qq{Please install either mod_perl 1 or mod_perl 2 first};
exit 0;
}
( run in 2.322 seconds using v1.01-cache-2.11-cpan-6aa56a78535 )