use strict; use ExtUtils::MakeMaker; use LWP::Simple qw(getstore $ua is_success); if ($ENV{HTTP_proxy_user} and $ENV{HTTP_proxy_pass} and $ENV{HTTP_proxy} =~ /^http:\/\/([^@]+)$/) { my $proxy ="http://$ENV{HTTP_proxy_user}:$ENV{HTTP_proxy_pass}\@" . $1; print "setting user/pass into proxy_env...\n"; $ua->proxy(['http'], $proxy); } my $fake = 'mod_perl-eapi.so'; my $real = 'mod_perl.so'; my $default = 'D:/Apache/modules'; print <<"END"; The Apache module $real is needed to complete the installation, and should be placed in your Apache2 modules directory. I will now fetch and install this for you. END my $remote = 'http://theoryx5.uwinnipeg.ca/ppmpackages/x86/' . $fake; print "Fetching $remote ... "; die "Fetching file failed" unless (is_success(getstore($remote, $real))); print " done!\n"; suggest_manual("Cannot find $real") unless -f $real; my $base = prompt("Where should $real be placed?", $default); $base = Win32::GetShortPathName($base) if $base =~ / /; $base =~ s/$real$//i; $base =~ s!\\!/!g; $base =~ s!/$!!; unless (-d $base) { my $ans = prompt("$base does not exist. Create it?", 'no'); if ($ans =~ /^y/i) { mkdir $base; suggest_manual("Could not create $base: $!") unless (-d $base); } else { suggest_manual("Will not create $base."); } } if (-f "$base/$real") { my $ans = prompt("$base/$real exists. Overwrite?", 'no'); if ($ans =~ /^n/i) { suggest_manual("Will not overwrite $base/$real."); } } use File::Copy; move($real, "$base/$real"); suggest_manual("Moving $real to $base failed: $!") unless (-f "$base/$real"); print "$real has been successfully installed to $base\n"; sleep(5); sub suggest_manual { my $msg = shift; print $msg, "\n"; print "Installation of $real not completed.\n"; sleep(5); exit(0); }