summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChip Salzenberg <chip@perl.com>1997-03-22 15:57:24 +1200
committerChip Salzenberg <chip@atlantic.net>1997-03-26 07:04:34 +1200
commit91a06757ac3b925b7c0c6afbf3f1378bd4051754 (patch)
tree0f4e19e9a2081019a69db3a99c4c784a7171721c
parenta3c8358ce414426ff5d7d0ca29f8d98f18d4c878 (diff)
downloadperl-91a06757ac3b925b7c0c6afbf3f1378bd4051754.tar.gz
Allow for coexistence of various versions of perldiag.pod
-rwxr-xr-xinstallperl28
-rw-r--r--lib/diagnostics.pm15
2 files changed, 36 insertions, 7 deletions
diff --git a/installperl b/installperl
index 764a6f917b..53468a9139 100755
--- a/installperl
+++ b/installperl
@@ -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,34 @@ 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);
+ link($from, $to);
+ }
}
# Check to make sure there aren't other perls around in installer's
@@ -307,7 +331,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!
diff --git a/lib/diagnostics.pm b/lib/diagnostics.pm
index 5e8e971f44..0bdf1be1fa 100644
--- a/lib/diagnostics.pm
+++ b/lib/diagnostics.pm
@@ -166,12 +166,16 @@ require 5.001;
use Carp;
use Config;
+($privlib, $archlib) = @Config{qw(privlibexp archlibexp)};
if ($^O eq 'VMS') {
- $PODFILE = VMS::Filespec::unixify($Config{privlibexp}).'/pod/perldiag.pod';
-}
-else {
- $PODFILE = $Config{privlibexp} . "/pod/perldiag.pod";
+ require VMS::Filespec;
+ $privlib = VMS::Filespec::unixify($privlib);
+ $archlib = VMS::Filespec::unixify($archlib);
}
+@trypod = ("$archlib/pod/perldiag.pod",
+ "$privlib/pod/perldiag-$].pod",
+ "$privlib/pod/perldiag.pod");
+($PODFILE) = ((grep { -e } @trypod), $trypod[$#trypod])[0];
$DEBUG ||= 0;
my $WHOAMI = ref bless []; # nobody's business, prolly not even mine
@@ -188,7 +192,8 @@ CONFIG: {
unless (caller) {
$standalone++;
require Getopt::Std;
- Getopt::Std::getopts('pdvf:') || die "Usage: $0 [-v] [-p] [-f splainpod]";
+ Getopt::Std::getopts('pdvf:')
+ or die "Usage: $0 [-v] [-p] [-f splainpod]";
$PODFILE = $opt_f if $opt_f;
$DEBUG = 2 if $opt_d;
$VERBOSE = $opt_v;