This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
UNIVERSAL.pm and import methods (tests)
[perl5.git] / installperl
index 764a6f9..9686bfb 100755 (executable)
@@ -1,7 +1,7 @@
 #!./perl
 
 BEGIN {
-    require 5.003_90;
+    require 5.004;
     @INC = 'lib';
     $ENV{PERL5LIB} = 'lib';
 }
@@ -11,7 +11,7 @@ use File::Compare;
 use File::Copy ();
 use File::Path ();
 use Config;
-use subs qw(unlink rename link chmod);
+use subs qw(unlink link chmod);
 
 # override the ones in the rest of the script
 sub mkpath {
@@ -217,10 +217,35 @@ if (! $versiononly) {
 
 if (! $versiononly || !($installprivlib =~ m/\Q$]/)) {
     mkpath("${installprivlib}/pod", 1, 0777);
+
+    # If Perl 5.003's perldiag.pod is there, rename it.
+    if (open POD, "${installprivlib}/pod/perldiag.pod") {
+       read POD, $_, 4000;
+       close POD;
+       # Some of Perl 5.003's diagnostic messages ended with periods.
+       if (/^=.*\.$/m) {
+           my ($from, $to) = ("${installprivlib}/pod/perldiag.pod",
+                              "${installprivlib}/pod/perldiag-5.003.pod");
+           print STDERR "  rename $from $to";
+           rename($from, $to)
+               or warn "Couldn't rename $from to $to: $!\n"
+               unless $nonono;
+       }
+    }
+
     foreach $file (@pods) {
        # $file is a name like  pod/perl.pod
        copy_if_diff($file, "${installprivlib}/${file}");
     }
+
+    # Link perldiag.pod into archlib
+    my ($from, $to) = ("${installprivlib}/pod/perldiag.pod",
+                      "${installarchlib}/pod/perldiag.pod");
+    if (compare($from, $to) || $nonono) {
+       mkpath("${installarchlib}/pod", 1, 0777);
+       unlink($to);
+       link($from, $to);
+    }
 }
 
 # Check to make sure there aren't other perls around in installer's
@@ -307,7 +332,7 @@ sub safe_rename {
     if (-f $to and not unlink($to)) {
        my($i);
        for ($i = 1; $i < 50; $i++) {
-           last if CORE::rename($to, "$to.$i");
+           last if rename($to, "$to.$i");
        }
        warn("Cannot rename to `$to.$i': $!"), return 0 
           if $i >= 50; # Give up!
@@ -324,7 +349,9 @@ sub link {
     eval {
        CORE::link($from, $to)
            ? $success++
-           : warn "Couldn't link $from to $to: $!\n"
+           : ($from =~ m#^/afs/# || $to =~ m#^/afs/#)
+             ? die "AFS"  # okay inside eval {}
+             : warn "Couldn't link $from to $to: $!\n"
          unless $nonono;
     };
     if ($@) {
@@ -390,7 +417,7 @@ sub installlib {
     }
 
     if (-f $_) {
-       if (/\.al$/ || /\.ix$/) {
+       if (/\.(?:al|ix)$/ && !($dir =~ m[^auto/(.*)$] && $archpms{$1})) {
            $installlib = $installprivlib;
            #We're installing *.al and *.ix files into $installprivlib,
            #but we have to delete old *.al and *.ix files from the 5.000