Apache-AppSamurai
view release on metacpan or search on metacpan
#!/usr/bin/perl -w
# $Id: Build.PL,v 1.19 2008/05/01 22:35:40 pauldoom Exp $
use strict;
use warnings;
use Module::Build;
# Decide right now if we are shooting for a mod_perl 1.x
# or mod_perl 2.x install. Defaults to mod_perl 2.x.
# This is to have a proper set of requirements in place
# so CPAN and others will behave.
my @extrareq = ();
if (eval{require mod_perl2;}) {
push(@extrareq, 'mod_perl2', 1.9922, 'Apache2::Request', 0);
print STDERR "mod_perl 2 detected: Setting requirements accordingly\n";
} elsif (eval{require mod_perl;}) {
push(@extrareq, 'mod_perl', 1.07, 'Apache::Request', 0);
print STDERR "mod_perl 1 detected: Setting requirements accordingly\n";
} else {
# Nothing found yet. Let's go with MP2
push(@extrareq, 'mod_perl2', 1.9922, 'Apache2::Request', 0);
print STDERR "mod_perl not detected: Setting requirements for mod_perl 2.x\n";
}
# Try to find a supported cipher module now. If none
# are present, Crypt::Rijndael is set as a requirement.
# No requirement set otherwise. (Recommendation will still appear)
my @blockciphers = ('Crypt::Rijndael', 'Crypt::OpenSSL::AES', 'Crypt::Twofish', 'Crypt::Blowfish');
my $bc;
while ($bc = shift @blockciphers) {
if (eval{requires $bc;}) {
print STDERR "$bc detected: Crypt::CBC block cipher needs met\n";
last;
}
}
if (scalar @blockciphers) {
push(@extrareq, 'Crypt::Rijndael', 0);
print STDERR "No suitable block ciphers detected. Setting requirement for Crypt::Rijndael\n";
}
# Add extra processing to install example files
my $class = Module::Build->subclass(code => <<'EOF');
sub process_misc_files {
my $self = shift;
# Copy the following trees into ./blib/
my @dirs = ( "examples");
my @found = ();
# Define a find matcher
my $mat = sub {-f $_ && ! /^(Root|Repository|Entries|Tag|.cvsignore)\z/s &&
push(@found, $File::Find::name);};
# Run a find under each $dir for normal, non-CVS files
foreach $dir (@dirs) { File::Find::find({wanted => $mat}, $dir); }
# Copy into ./bdir
foreach (@found) {
$self->copy_if_modified(from => $_, to => "blib/" . $_);
}
}
EOF
my $builder = $class->new(
module_name => 'Apache::AppSamurai',
license => 'perl',
dist_author => 'Paul M. Hirsch <paul@voltagenoir.org>',
( run in 0.466 second using v1.01-cache-2.11-cpan-39bf76dae61 )