This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
warn about /(?p{})/ (from Simon Cozens)
authorGurusamy Sarathy <gsar@cpan.org>
Fri, 3 Mar 2000 03:27:52 +0000 (03:27 +0000)
committerGurusamy Sarathy <gsar@cpan.org>
Fri, 3 Mar 2000 03:27:52 +0000 (03:27 +0000)
p4raw-id: //depot/perl@5475

regcomp.c
toke.c

index f4fcaa9..a1272eb 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -1734,6 +1734,9 @@ S_reg(pTHX_ I32 paren, I32 *flagp)
                nextchar();
                *flagp = TRYAGAIN;
                return NULL;
+           case 'p':
+               Perl_warner(aTHX_ WARN_REGEXP, "(?p{}) is deprecated - use (??{})");
+               /* FALL THROUGH*/
            case '?':
                logical = 1;
                paren = *PL_regcomp_parse++;
diff --git a/toke.c b/toke.c
index 3af0896..79ee972 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -1269,8 +1269,8 @@ S_scan_const(pTHX_ char *start)
            if (s[2] == '#') {
                while (s < send && *s != ')')
                    *d++ = *s++;
-           } else if (s[2] == '{'
-                      || s[2] == '?' && s[3] == '{') { /* This should march regcomp.c */
+           } else if (s[2] == '{' /* This should match regcomp.c */
+                      || (s[2] == 'p' || s[2] == '?') && s[3] == '{') {        
                I32 count = 1;
                char *regparse = s + (s[2] == '{' ? 3 : 4);
                char c;