Change 17820 by gsar@rake on 2002/08/30 19:55:21

        integrate macperl changes#17657,17658,17663,17664
        
               Neglected to include old bugfix from main branch
        
               Count line numbers properly in MacPerl app
        
               Portability fixes for blib
               (already in 5.8/5.9)
        
               Minor test fixes

Affected files ...

.... //depot/maint-5.6/perl/lib/blib.pm#2 integrate
.... //depot/maint-5.6/perl/perl.c#54 integrate
.... //depot/maint-5.6/perl/t/lib/filespec.t#6 integrate
.... //depot/maint-5.6/perl/t/op/magic.t#9 integrate

Differences ...

==== //depot/maint-5.6/perl/lib/blib.pm#2 (text) ====
Index: perl/lib/blib.pm
--- perl/lib/blib.pm#1~5902~    Mon Mar 27 17:59:14 2000
+++ perl/lib/blib.pm    Fri Aug 30 12:55:21 2002
@@ -34,12 +34,14 @@
 
 Nick Ing-Simmons [EMAIL PROTECTED]
 
-=cut 
+=cut
 
 use Cwd;
+use File::Spec;
 
-use vars qw($VERSION);
-$VERSION = '1.00';
+use vars qw($VERSION $Verbose);
+$VERSION = '1.02';
+$Verbose = 0;
 
 sub import
 {
@@ -51,20 +53,32 @@
    $dir = shift;
    $dir =~ s/blib\z//;
    $dir =~ s,/+\z,,;
-   $dir = '.' unless ($dir);
+   $dir = File::Spec->curdir unless ($dir);
    die "$dir is not a directory\n" unless (-d $dir);
   }
- my $i   = 5;
+ my $i = 5;
+ my($blib, $blib_lib, $blib_arch);
  while ($i--)
   {
-   my $blib = "${dir}/blib";
-   if (-d $blib && -d "$blib/arch" && -d "$blib/lib")
+   $blib = File::Spec->catdir($dir, "blib");
+   $blib_lib = File::Spec->catdir($blib, "lib");
+
+   if ($^O eq 'MacOS')
+    {
+     $blib_arch = File::Spec->catdir($blib_lib, $MacPerl::Architecture);
+    }
+   else
+    {
+     $blib_arch = File::Spec->catdir($blib, "arch");
+    }
+
+   if (-d $blib && -d $blib_arch && -d $blib_lib)
     {
-     unshift(@INC,"$blib/arch","$blib/lib");
-     warn "Using $blib\n";
+     unshift(@INC,$blib_arch,$blib_lib);
+     warn "Using $blib\n" if $Verbose;
      return;
     }
-   $dir .= "/..";
+   $dir = File::Spec->catdir($dir, File::Spec->updir);
   }
  die "Cannot find blib even in $dir\n";
 }

==== //depot/maint-5.6/perl/perl.c#54 (text) ====
Index: perl/perl.c
--- perl/perl.c#53~16508~       Wed May  8 17:24:00 2002
+++ perl/perl.c Fri Aug 30 12:55:21 2002
@@ -1010,7 +1010,7 @@
 #ifdef MACOS_TRADITIONAL
            /* ignore -e for Dev:Pseudo argument */
            if (argv[1] && !strcmp(argv[1], "Dev:Pseudo"))
-               break; 
+               break;
 #endif
            if (PL_euid != PL_uid || PL_egid != PL_gid)
                Perl_croak(aTHX_ "No -e allowed in setuid scripts");
@@ -1452,7 +1452,9 @@
 
        if (PL_minus_c) {
 #ifdef MACOS_TRADITIONAL
-           PerlIO_printf(Perl_error_log, "# %s syntax OK\n", 
MacPerl_MPWFileName(PL_origfilename));
+           PerlIO_printf(Perl_error_log, "%s%s syntax OK\n",
+               (gMacPerl_ErrorFormat ? "# " : ""),
+               MacPerl_MPWFileName(PL_origfilename));
 #else
            PerlIO_printf(Perl_error_log, "%s syntax OK\n", PL_origfilename);
 #endif
@@ -3054,26 +3056,30 @@
 S_find_beginning(pTHX)
 {
     register char *s, *s2;
+#ifdef MACOS_TRADITIONAL
+    int maclines = 0;
+#endif
 
     /* skip forward in input to the real script? */
 
     forbid_setid("-x");
 #ifdef MACOS_TRADITIONAL
     /* Since the Mac OS does not honor #! arguments for us, we do it ourselves */
+
     while (PL_doextract || gMacPerl_AlwaysExtract) {
        if ((s = sv_gets(PL_linestr, PL_rsfp, 0)) == Nullch) {
            if (!gMacPerl_AlwaysExtract)
                Perl_croak(aTHX_ "No Perl script found in input\n");
-               
+
            if (PL_doextract)                   /* require explicit override ? */
                if (!OverrideExtract(PL_origfilename))
                    Perl_croak(aTHX_ "User aborted script\n");
                else
                    PL_doextract = FALSE;
-               
+
            /* Pater peccavi, file does not have #! */
            PerlIO_rewind(PL_rsfp);
-           
+
            break;
        }
 #else
@@ -3095,7 +3101,18 @@
                        ;
            }
 #ifdef MACOS_TRADITIONAL
+           /* We are always searching for the #!perl line in MacPerl,
+            * so if we find it, still keep the line count correct
+            * by counting lines we already skipped over
+            */
+           for (; maclines > 0 ; maclines--)
+               PerlIO_ungetc(PL_rsfp, '\n');
+
            break;
+
+       /* gMacPerl_AlwaysExtract is false in MPW tool */
+       } else if (gMacPerl_AlwaysExtract) {
+           ++maclines;
 #endif
        }
     }

==== //depot/maint-5.6/perl/t/lib/filespec.t#6 (xtext) ====
Index: perl/t/lib/filespec.t
--- perl/t/lib/filespec.t#5~12597~      Mon Oct 22 15:02:50 2001
+++ perl/t/lib/filespec.t       Fri Aug 30 12:55:21 2002
@@ -3,6 +3,9 @@
 BEGIN {
     chdir 't' if -d 't';
     @INC = '../lib';
+    if ($^O eq 'MacOS') {
+       push @INC, "::lib:$MacPerl::Architecture";
+    }
 }
 # Grab all of the plain routines from File::Spec
 use File::Spec @File::Spec::EXPORT_OK ;
@@ -37,7 +40,6 @@
 # tests are skipped on other OSs
 my $root;
 if ($^O eq 'MacOS') {
-       push @INC, "::lib:$MacPerl::Architecture";
        $root = File::Spec::Mac->rootdir();
 }
 

==== //depot/maint-5.6/perl/t/op/magic.t#9 (xtext) ====
Index: perl/t/op/magic.t
--- perl/t/op/magic.t#8~17424~  Mon Jul  8 12:54:10 2002
+++ perl/t/op/magic.t   Fri Aug 30 12:55:21 2002
@@ -186,8 +186,8 @@
 
     local $ENV{PATH}= ".";
     (my $script_name = $script) =~ s/.*(show-shebang)/$1/;
-    $s1 = "\$^X is $perl, \$0 is $script_name\n" if $Is_MSWin32;
-    $_ = `$script_name`;
+    $s1 = "\$^X is $perl, \$0 is $script_name\n" if $Is_MSWin32 || $Is_MacOS;
+    $_ = $Is_MacOS ? `$perl $script_name` : `$script_name`;
     s/\.exe//i if $Is_Dos or $Is_Cygwin or $Is_os2;
     s{\bminiperl\b}{perl}; # so that test doesn't fail with miniperl
     s{is perl}{is $perl}; # for systems where $^X is only a basename
End of Patch.

Reply via email to