In perl.git, the branch blead has been updated
<http://perl5.git.perl.org/perl.git/commitdiff/e6897b1a5db0410e387ccbf677e89fc4a1d8c97a?hp=d9bf0e0a91525fcdd8099d78b891aa20066e9d1c>
- Log -----------------------------------------------------------------
commit e6897b1a5db0410e387ccbf677e89fc4a1d8c97a
Author: Karl Williamson <k...@khw-desktop.(none)>
Date: Wed Jun 9 14:40:14 2010 -0600
Deprecate no space between pattern, following word
This patch raises a deprecated warning on constructs like
$result = $a =~ m/$foo/sand $bar;
which means
$result = $a =~ m/$foo/s and $bar;
-----------------------------------------------------------------------
Summary of changes:
pod/perldiag.pod | 18 +++++++++++++++++-
t/lib/warnings/toke | 5 ++++-
toke.c | 6 ++++++
3 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index 4d7d6ad..26c35a0 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -1913,6 +1913,23 @@ spots. This is now heavily deprecated.
(F) The parser has given up trying to parse the program after 10 errors.
Further error messages would likely be uninformative.
+=item Having no space between pattern and following word is deprecated
+
+(D syntax)
+
+You had a word that isn't a regex modifier immediately following a pattern
+without an intervening space. For example, the two constructs:
+
+ $a =~ m/$foo/sand $bar
+ $a =~ m/$foo/s and $bar
+
+both currently mean the same thing, but it is planned to disallow the first
form
+in Perl 5.16. And,
+
+ $a =~ m/$foo/and $bar
+
+will be disallowed too.
+
=item Hexadecimal number > 0xffffffff non-portable
(W portable) The hexadecimal number you specified is larger than 2**32-1
@@ -2855,7 +2872,6 @@ your system.
(F) The indicated command line switch needs a mandatory argument, but
you haven't specified one.
-
=item No such class field "%s" in variable %s of type %s
(F) You tried to access a key from a hash through the indicated typed variable
diff --git a/t/lib/warnings/toke b/t/lib/warnings/toke
index 2236442..6a1a6a5 100644
--- a/t/lib/warnings/toke
+++ b/t/lib/warnings/toke
@@ -140,13 +140,16 @@ Use of comma-less variable list is deprecated at - line 4.
Use of comma-less variable list is deprecated at - line 4.
########
# toke.c
+$a =~ m/$foo/sand $bar;
$a = <<;
no warnings 'deprecated' ;
+$a =~ m/$foo/sand $bar;
$a = <<;
EXPECT
-Use of bare << to mean <<"" is deprecated at - line 2.
+Having no space between pattern and following word is deprecated at - line 2.
+Use of bare << to mean <<"" is deprecated at - line 3.
########
# toke.c
use warnings 'syntax' ;
diff --git a/toke.c b/toke.c
index daa60a1..a94753a 100644
--- a/toke.c
+++ b/toke.c
@@ -11887,6 +11887,12 @@ S_scan_pat(pTHX_ char *start, I32 type)
#endif
while (*s && strchr(valid_flags, *s))
pm->op_pmflags = S_pmflag(pm->op_pmflags, *s++);
+
+ if (isALNUM(*s)) {
+ Perl_ck_warner_d(aTHX_ packWARN(WARN_SYNTAX),
+ "Having no space between pattern and following word is deprecated");
+
+ }
#ifdef PERL_MAD
if (PL_madskills && modstart != s) {
SV* tmptoken = newSVpvn(modstart, s - modstart);
--
Perl5 Master Repository