From: Ilya Zakharevich Date: Wed, 4 Aug 1999 16:46:57 +0000 (-0400) Subject: Deprecate /^/ implictly meaning /^/m. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2cdd06f700e22243a0f92357f562eb4b13b7197a;p=p5sagit%2Fp5-mst-13.2.git Deprecate /^/ implictly meaning /^/m. To: Gurusamy Sarathy Cc: Tom Christiansen , chaimf@pobox.com, ed@chronos.net, perl5-porters@perl.org Subject: [PATCH 5.00557] split /^/ Message-ID: <19990804164657.A3776@monk.mps.ohio-state.edu> p4raw-id: //depot/cfgperl@3922 --- diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 2542838..0ff865d 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -2594,6 +2594,10 @@ See L. (F) A sort comparison subroutine may not return a list value with more or less than one element. See L. +=item split /^/ better written as split /^/m + +(W) Implicit translation of /^/ to mean /^/m in split is deprecated. + =item Split loop (P) The split was looping infinitely. (Obviously, a split shouldn't iterate diff --git a/pp.c b/pp.c index 18c875b..e3969be 100644 --- a/pp.c +++ b/pp.c @@ -5007,7 +5007,13 @@ PP(pp_split) ++s; } } - else if (strEQ("^", rx->precomp)) { + else if (rx->prelen == 1 && *rx->precomp == '^') { + if (!(pm->op_pmflags & PMf_MULTILINE) + && !(pm->op_pmregexp->reganch & ROPT_WARNED)) { + if (ckWARN(WARN_DEPRECATED)) + warn("split /^/ better written as split /^/m"); + pm->op_pmregexp->reganch |= ROPT_WARNED; + } while (--limit) { /*SUPPRESS 530*/ for (m = s; m < strend && *m != '\n'; m++) ; diff --git a/regexp.h b/regexp.h index 5d787e0..414b254 100644 --- a/regexp.h +++ b/regexp.h @@ -69,6 +69,8 @@ typedef struct regexp { #define RE_INTUIT_ONECHAR 0x4000000 #define RE_INTUIT_TAIL 0x8000000 +#define ROPT_WARNED 0x10000000 + #define RE_USE_INTUIT (RE_USE_INTUIT_NOML|RE_USE_INTUIT_ML) #define REINT_AUTORITATIVE (REINT_AUTORITATIVE_NOML|REINT_AUTORITATIVE_ML) #define REINT_ONCE (REINT_ONCE_NOML|REINT_ONCE_ML)