This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Deprecate no space after s/a/b/ and keyword
authorKarl Williamson <khw@khw-desktop.(none)>
Sat, 26 Jun 2010 23:41:40 +0000 (17:41 -0600)
committerJesse Vincent <jesse@bestpractical.com>
Tue, 29 Jun 2010 02:30:05 +0000 (22:30 -0400)
Pattern replacements need to have the deprecation added; the prior patch
on this ticket only changed m/a/keyword; this adds the s/a/b/keyword

t/lib/warnings/toke
toke.c

index 6a1a6a5..4bb131f 100644 (file)
@@ -141,15 +141,18 @@ Use of comma-less variable list is deprecated at - line 4.
 ########
 # toke.c
 $a =~ m/$foo/sand $bar;
+$a =~ s/$foo/fool/sand $bar;
 $a = <<;
 
 no warnings 'deprecated' ;
 $a =~ m/$foo/sand $bar;
+$a =~ s/$foo/fool/sand $bar;
 $a = <<;
 
 EXPECT
 Having no space between pattern and following word is deprecated at - line 2.
-Use of bare << to mean <<"" is deprecated at - line 3.
+Having no space between pattern and following word is deprecated at - line 3.
+Use of bare << to mean <<"" is deprecated at - line 4.
 ########
 # toke.c
 use warnings 'syntax' ;
diff --git a/toke.c b/toke.c
index 8cbe28a..7da7ab9 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -11974,8 +11974,14 @@ S_scan_subst(pTHX_ char *start)
        }
        else if (strchr(S_PAT_MODS, *s))
            pm->op_pmflags = S_pmflag(pm->op_pmflags, *s++);
-       else
+       else {
+           if (isALNUM(*s)) {
+               Perl_ck_warner_d(aTHX_ packWARN(WARN_SYNTAX),
+                   "Having no space between pattern and following word is deprecated");
+
+           }
            break;
+       }
     }
 
 #ifdef PERL_MAD