Fix bug #18874, essentially by reverting change #11890.
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Fri, 6 Dec 2002 20:44:26 +0000 (20:44 +0000)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Fri, 6 Dec 2002 20:44:26 +0000 (20:44 +0000)
Add a regression test for it.
p4raw-link: @11890 on //depot/perl: be154528f7e7dc31589b7b72d4e03f88d8751799

p4raw-id: //depot/perl@18250

lib/English.pm
lib/English.t

index 05dd05c..6cd3acd 100644 (file)
@@ -57,9 +57,9 @@ sub import {
         *EXPORT = \@COMPLETE_EXPORT ;
         $globbed_match ||= (
            eval q{
-               *MATCH                          = \$&   ;
-               *PREMATCH                               = \$`   ;
-               *POSTMATCH                              = \$'   ;
+               *MATCH                          = *&    ;
+               *PREMATCH                       = *`    ;
+               *POSTMATCH                      = *'    ;
                1 ;
               }
            || do {
@@ -144,87 +144,87 @@ sub import {
 
 # Matching.
 
-       *LAST_PAREN_MATCH                       = \$+   ;
-       *LAST_SUBMATCH_RESULT                   = \$^N ;
-       *LAST_MATCH_START                       = \@- ;
-       *LAST_MATCH_END                         = \@+ ;
+       *LAST_PAREN_MATCH                       = *+    ;
+       *LAST_SUBMATCH_RESULT                   = *^N ;
+       *LAST_MATCH_START                       = *-{ARRAY} ;
+       *LAST_MATCH_END                         = *+{ARRAY} ;
 
 # Input.
 
-       *INPUT_LINE_NUMBER                      = \$.   ;
-           *NR                                 = \$.   ;
-       *INPUT_RECORD_SEPARATOR                 = \$/   ;
-           *RS                                 = \$/   ;
+       *INPUT_LINE_NUMBER                      = *.    ;
+           *NR                                 = *.    ;
+       *INPUT_RECORD_SEPARATOR                 = */    ;
+           *RS                                 = */    ;
 
 # Output.
 
-       *OUTPUT_AUTOFLUSH                       = \$|   ;
-       *OUTPUT_FIELD_SEPARATOR                 = \$,   ;
-           *OFS                                = \$,   ;
-       *OUTPUT_RECORD_SEPARATOR                = \$\   ;
-           *ORS                                = \$\   ;
+       *OUTPUT_AUTOFLUSH                       = *|    ;
+       *OUTPUT_FIELD_SEPARATOR                 = *,    ;
+           *OFS                                = *,    ;
+       *OUTPUT_RECORD_SEPARATOR                = *\    ;
+           *ORS                                = *\    ;
 
 # Interpolation "constants".
 
-       *LIST_SEPARATOR                         = \$"   ;
-       *SUBSCRIPT_SEPARATOR                    = \$;   ;
-           *SUBSEP                             = \$;   ;
+       *LIST_SEPARATOR                         = *"    ;
+       *SUBSCRIPT_SEPARATOR                    = *;    ;
+           *SUBSEP                             = *;    ;
 
 # Formats
 
-       *FORMAT_PAGE_NUMBER                     = \$%   ;
-       *FORMAT_LINES_PER_PAGE                  = \$=   ;
-       *FORMAT_LINES_LEFT                      = \$-   ;
-       *FORMAT_NAME                            = \$~   ;
-       *FORMAT_TOP_NAME                        = \$^   ;
-       *FORMAT_LINE_BREAK_CHARACTERS           = \$:   ;
-       *FORMAT_FORMFEED                        = \$^L  ;
+       *FORMAT_PAGE_NUMBER                     = *%    ;
+       *FORMAT_LINES_PER_PAGE                  = *=    ;
+       *FORMAT_LINES_LEFT                      = *-    ;
+       *FORMAT_NAME                            = *~    ;
+       *FORMAT_TOP_NAME                        = *^    ;
+       *FORMAT_LINE_BREAK_CHARACTERS           = *:    ;
+       *FORMAT_FORMFEED                        = *^L   ;
 
 # Error status.
 
-       *CHILD_ERROR                            = \$?   ;
-       *OS_ERROR                               = \$!   ;
-           *ERRNO                              = \$!   ;
-       *OS_ERROR                               = \%!   ;
-           *ERRNO                              = \%!   ;
-       *EXTENDED_OS_ERROR                      = \$^E  ;
-       *EVAL_ERROR                             = \$@   ;
+       *CHILD_ERROR                            = *?    ;
+       *OS_ERROR                               = *!    ;
+           *ERRNO                              = *!    ;
+       *OS_ERROR                               = *!    ;
+           *ERRNO                              = *!    ;
+       *EXTENDED_OS_ERROR                      = *^E   ;
+       *EVAL_ERROR                             = *@    ;
 
 # Process info.
 
-       *PROCESS_ID                             = \$$   ;
-           *PID                                = \$$   ;
-       *REAL_USER_ID                           = \$<   ;
-           *UID                                = \$<   ;
-       *EFFECTIVE_USER_ID                      = \$>   ;
-           *EUID                               = \$>   ;
-       *REAL_GROUP_ID                          = \$(   ;
-           *GID                                = \$(   ;
-       *EFFECTIVE_GROUP_ID                     = \$)   ;
-           *EGID                               = \$)   ;
-       *PROGRAM_NAME                           = \$0   ;
+       *PROCESS_ID                             = *$    ;
+           *PID                                = *$    ;
+       *REAL_USER_ID                           = *<    ;
+           *UID                                = *<    ;
+       *EFFECTIVE_USER_ID                      = *>    ;
+           *EUID                               = *>    ;
+       *REAL_GROUP_ID                          = *(    ;
+           *GID                                = *(    ;
+       *EFFECTIVE_GROUP_ID                     = *)    ;
+           *EGID                               = *)    ;
+       *PROGRAM_NAME                           = *0    ;
 
 # Internals.
 
-       *PERL_VERSION                           = \$^V  ;
-       *ACCUMULATOR                            = \$^A  ;
-       *COMPILING                              = \$^C  ;
-       *DEBUGGING                              = \$^D  ;
-       *SYSTEM_FD_MAX                          = \$^F  ;
-       *INPLACE_EDIT                           = \$^I  ;
-       *PERLDB                                 = \$^P  ;
-       *LAST_REGEXP_CODE_RESULT                = \$^R  ;
-       *EXCEPTIONS_BEING_CAUGHT                = \$^S  ;
-       *BASETIME                               = \$^T  ;
-       *WARNING                                = \$^W  ;
-       *EXECUTABLE_NAME                        = \$^X  ;
-       *OSNAME                                 = \$^O  ;
+       *PERL_VERSION                           = *^V   ;
+       *ACCUMULATOR                            = *^A   ;
+       *COMPILING                              = *^C   ;
+       *DEBUGGING                              = *^D   ;
+       *SYSTEM_FD_MAX                          = *^F   ;
+       *INPLACE_EDIT                           = *^I   ;
+       *PERLDB                                 = *^P   ;
+       *LAST_REGEXP_CODE_RESULT                = *^R   ;
+       *EXCEPTIONS_BEING_CAUGHT                = *^S   ;
+       *BASETIME                               = *^T   ;
+       *WARNING                                = *^W   ;
+       *EXECUTABLE_NAME                        = *^X   ;
+       *OSNAME                                 = *^O   ;
 
 # Deprecated.
 
-#      *ARRAY_BASE                             = \$[   ;
-#      *OFMT                                   = \$#   ;
-#      *MULTILINE_MATCHING                     = \$*   ;
-#      *OLD_PERL_VERSION                       = \$]   ;
+#      *ARRAY_BASE                             = *[    ;
+#      *OFMT                                   = *#    ;
+#      *MULTILINE_MATCHING                     = **    ;
+#      *OLD_PERL_VERSION                       = *]    ;
 
 1;
index 49819fc..d7466c2 100755 (executable)
@@ -6,7 +6,7 @@ BEGIN {
     @INC = '../lib';
 }
 
-use Test::More tests => 54;
+use Test::More tests => 55;
 
 use English qw( -no_match_vars ) ;
 use Config;
@@ -142,6 +142,12 @@ main::is( $PREMATCH, 'a', '$PREMATCH defined' );
 main::is( $MATCH, 'b', '$MATCH defined' );
 main::is( $POSTMATCH, 'c', '$POSTMATCH defined' );
 
+{
+    my $s = "xyz";
+    $s =~ s/y/t$MATCH/;
+    main::is( $s, "xtyz", '$MATCH defined in right side of s///' );
+}
+
 package C;
 
 use English qw( -no_match_vars ) ;