#!C:/Perl/bin/perl 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); } use Config; my @path_ext = (); path_ext(); my $make = $Config{make} || which('make') || $CPAN::Config->{make}; unless ($make and -e $make) { print <<'NMAKE'; ============================================================================= I cannot find a make program. If you are running an ActivePerl-compatible Win32 perl, you can obtain nmake from http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-US/Nmake15.exe. I can fetch and install that for you, if you like. ============================================================================= NMAKE my $ans = prompt('Fetch nmake?', 'yes'); if ($ans =~ /^y/i) { fetch_nmake() or die "Could not install nmake"; } else { die 'Cannot function without nmake'; } } eval {require CPAN::Config;}; if (not $@) { die <<'WARN'; ============================================================================ It appears you have yet to configure the CPAN.pm module, PPM::Make would use this to map module to distribution names. You can configure CPAN.pm by typing C:\> perl -MCPAN -e shell and following through the dialogue. You can change an existing configuration by typing, within the CPAN.pm shell, cpan> o conf init =========================================================================== WARN } sub path_ext { if ($ENV{PATHEXT}) { push @path_ext, split ';', $ENV{PATHEXT}; for my $ext (@path_ext) { $ext =~ s/^\.*(.+)$/$1/; } } else { #Win9X: doesn't have PATHEXT push @path_ext, qw(com exe bat); } } sub which { my $program = shift; return undef unless $program; my @results = (); for my $base (map { File::Spec->catfile($_, $program) } File::Spec->path()) { if ($ENV{HOME} and not WIN32) { # only works on Unix, but that's normal: # on Win32 the shell doesn't have special treatment of '~' $base =~ s/~/$ENV{HOME}/o; } return $base if -x $base; if (WIN32) { for my $ext (@path_ext) { return "$base.$ext" if -x "$base.$ext"; } } } } sub fetch_nmake { my $nmake = 'nmake15.exe'; my $r = 'http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-US/Nmake15.exe'; eval {require LWP::Simple; import LWP::Simple qw(getstore)}; if ($@) { warn "LWP::Simple is needed to get $nmake"; return; } unless (is_success(getstore($r, $nmake))) { warn "Could not fetch $nmake"; return; } unless (-e $nmake) { warn "Getting $nmake failed"; return; } my @args = ($nmake); system(@args); my ($exe, $err) = ('nmake.exe', 'nmake.err'); unless (-e $exe and -e $err) { warn "Extraction of $exe and $err failed"; return; } use File::Copy; my $dir = prompt('Which directory on your PATH should I copy the files to?', $Config{bin}); unless (-d $dir) { my $ans = prompt(qq{$dir doesn\'t exist. Create it?}, 'yes'); if ($ans =~ /^y/i) { mkdir $dir or do { warn "Could not create $dir: $!"; return; }; } else { warn "Will not create $dir"; return; } } for ($exe, $err, 'README.TXT') { move($_, $dir) or do { warn "Moving $_ to $dir failed: $!"; return; }; } unlink $nmake or warn "Unlink of $nmake failed: $!"; return 1; }