Michiel Beijen a écrit :
I'd like to know if it's possible to build mod_perl on Win32; I'd like
to use mod_perl with StrawberryPerl. It seems to be that the only way
that could be done is to compile Apache also with MinGW, and that's not
possible because of limited support for Windows Shared Memory in MinGW
Here is how I installed StrawberryPerl + mod_perl + apache2 on Windows (tested onVista):

1. Apache
Go to http://httpd.apache.org/download.cgi
Click on "/Win32 Binary including OpenSSL 0.9.8i (MSI Installer) /"
Some recommend to install it in a directory without space, although I did not do that and it still work.

2. Perl
Go to http://strawberryperl.com/ and install the latest kit

3. I then use the script send in attachement to install all modules I need, e.g. perl install_modules.pl

At the top of the script you will see how to get mod_perl2 and various other stuff I need for my project. Just the lines for the modules you do not need.

HTH,

Cheers, JD.

#!/usr/bin/perl

#
## This script, intended to be run by an installer on Windows
## will hopefully verify packages needed by Freecity are
## installed - and will attempt to install them if needed
#
## (c) 2008 by Jean-Damien Durand <jeandamiendur...@free.fr>
#
use 5.10.0;
use strict;
use diagnostics;
use Config;
use File::Spec;
use CPAN;

my %required_modules = (
    'mod_perl2'         => 
'http://cpan.uwinnipeg.ca/PPMPackages/10xx/mod_perl.ppd',
    'Apache2::Request'  => 
'http://cpan.uwinnipeg.ca/PPMPackages/10xx/libapreq2.ppd',
    'GD'                => 'http://www.bribes.org/perl/ppm/GD.ppd',
    'GD::Text'          => 'http://www.bribes.org/perl/ppm/GDTextUtil.ppd',
    'Template'          => 
'http://cpan.uwinnipeg.ca/PPMPackages/10xx/Template-Toolkit.ppd',
    'Config::General'   => 
'http://cpan.uwinnipeg.ca/PPMPackages/10xx/Config-General.ppd',
    'Apache::DBI'       => 'http://trouchelle.com/ppm10/Apache-DBI.ppd',
    'CGI::Simple'       => 'http://trouchelle.com/ppm10/CGI-Simple.ppd',
    'HTML::Tree'        => 'http://trouchelle.com/ppm10/HTML-Tree.ppd',
    'File::Type'        => 'http://trouchelle.com/ppm10/File-Type.ppd',
    'Image::Size'       => 'http://trouchelle.com/ppm10/Image-Size.ppd',
    'Net::Telnet'       => 'http://trouchelle.com/ppm10/Net-Telnet.ppd',
    'I18N::Charset'     => 'http://trouchelle.com/ppm10/I18N-Charset.ppd',
    'XML::RSS'          => 'http://trouchelle.com/ppm10/XML-RSS.ppd',
    'Win32::Process'    => 'http://trouchelle.com/ppm10/Win32-Process.ppd',
    'Win32::DriveInfo'  => 'http://trouchelle.com/ppm10/Win32-DriveInfo.ppd',
    'List::MoreUtils'   => 
'http://cpan.uwinnipeg.ca/PPMPackages/10xx/List-MoreUtils.ppd',
    'Win32::FileOp'     => 'http://trouchelle.com/ppm10/Win32-FileOp.ppd',
    'Win32::Service'    => 'http://trouchelle.com/ppm10/Win32-Service.ppd',
    'Win32::OLE'        => 'http://www.bribes.org/perl/ppm/Win32-OLE.ppd',
    'Text::Chomp'       => 'http://trouchelle.com/ppm10/Text-Chomp.ppd',
    'Number::Format'    => 'http://trouchelle.com/ppm10/Number-Format.ppd',
    'Object::Multitype' => 'http://trouchelle.com/ppm10/Object-MultiType.ppd',
    'Win32::IPHelper'   => 'http://trouchelle.com/ppm10/Win32-IPHelper.ppd',
    'NetAddr::IP'       => 'http://trouchelle.com/ppm10/NetAddr-IP.ppd'
    );
                   
print "\n";
print "----------------------------------------------------\n";
print "Freecity va verifier et installer si necessaire des \n";
print "modules perl necessaires a son fonctionnement.      \n";
print "----------------------------------------------------\n";
print "                                                    \n";
print "<Appuyez sur Entree ou Return pour continuer>       \n";
print "                                                    \n";

my $dummy;
read(STDIN, $dummy, 1);

#  -----------------------------
## Get install directory of perl
#  -----------------------------
my $installbin = $Config{installbin} || die "No installbin in perl config !?\n";
my $installsitelib = $Config{installsitelib} || die "No installsitelib in perl 
config !?\n";

#  ---------------------------
## This is for Time::ParseDate
#  ---------------------------
$ENV{TZ}='PST8PDT';

#  ----------------------
## Check required modules
#  ----------------------
my $module;
my $cpanmod;
my $ppm = File::Spec->catfile($installbin, 'ppm.bat');
foreach $module (sort keys %required_modules) {
    my $found = 0;
    #
    ## For GD we force the installation
    #
    if ($module ne 'GD') {
        foreach $cpanmod (CPAN::Shell->expand("Module", $module)){
            ++$found;
            if ($cpanmod->inst_file) {
                print $cpanmod->id, " is already installed\n";
                next;
            }
            install_module($module);
            last;
        }
    } else {
        print "Forcing $module installation\n";
    }
    if ($found == 0) {
        install_module($module);
    }
}

#
## Special hook for Params::Validate that is since recently... buggy - move to 
a perl only solution
#
my $validatedll = File::Spec->catfile($installsitelib, 'auto', 'Params', 
'Validate', 'Validate.dll');
my $newvalidatedll = File::Spec->catfile($installsitelib, 'auto', 'Params', 
'Validate', '_Validate.dll');
if (-e $validatedll) {
    print "Installing Params::Validate hook\n";
    unlink($newvalidatedll);
    print "... rename $validatedll to $newvalidatedll\n";
    rename($validatedll, $newvalidatedll);
}

sub install_module {
    my $module = shift;

    if (! defined($required_modules{$module})) {
        print "\n";
        print "=====================================================\n";
        print "Freecity is installing $module (CPAN way)\n";
        print "=====================================================\n";
        print "\n";
        #
        ## CPAN style
        #
        if ($module eq 'Number::Format') {
            #
            ## A special case
            #
            CPAN::Shell->force('install', $module);
        } else {
            CPAN::Shell->install($module);
        }
    } else {
        print "\n";
        print "=====================================================\n";
        print "Freecity is installing $module (PPM way)\n";
        print "=====================================================\n";
        print "\n";
        #
        ## PPM style
        #
        system($ppm, 'install', $required_modules{$module});
    }
}

1;

Reply via email to