This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate mainline
[perl5.git] / x2p / s2p.PL
index 9a084f9..7e65401 100644 (file)
@@ -3,6 +3,28 @@
 use Config;
 use File::Basename qw(&basename &dirname);
 use Cwd;
+use subs qw(link);
+
+sub link { # This is a cutdown vesion of installperl:link().
+    my($from,$to) = @_;
+    my($success) = 0;
+
+    eval {
+       CORE::link($from, $to)
+           ? $success++
+           : ($from =~ m#^/afs/# || $to =~ m#^/afs/#)
+             ? die "AFS"  # okay inside eval {}
+             : die "Couldn't link $from to $to: $!\n";
+    };
+    if ($@) {
+       warn $@;
+       require File::Copy;
+       File::Copy::copy($from, $to)
+           ? $success++
+           : warn "Couldn't copy $from to $to: $!\n";
+    }
+    $success;
+}
 
 # List explicitly here the variables you want Configure to
 # generate.  Metaconfig only looks for shell variables, so you
@@ -43,7 +65,7 @@ $Config{perlpath}
 
 print OUT <<'!NO!SUBS!';
 
-$0 =~ s/^.*?(\w+)$/$1/;
+$0 =~ s/^.*?(\w+)[\.\w]*$/$1/;
 
 # (p)sed - a stream editor
 # History:  Aug 12 2000: Original version.
@@ -1795,7 +1817,7 @@ if( $doGenerate ){
 #!$perlpath -w
 eval 'exec $perlpath -S \$0 \${1+"\$@"}'
   if 0;
-\$0 =~ s/^.*?(\\w+)\$/\$1/;
+\$0 =~ s/^.*?(\\w+)\[\\.\\w+\]*\$/\$1/;
 
 use strict;
 use Symbol;