develooper Front page | perl.perl5.porters | Postings from July 2001

[PATCH toke.c pod/perlop.pod] qr//o <-- no-op

Thread Next
Jeff 'japhy' Pinyan
July 11, 2001 11:57
[PATCH toke.c pod/perlop.pod] qr//o <-- no-op
Message ID:
For some reason, we allow the /o modifier on qr// objects.  It's a waste,
but rather than make it a syntax error, I just pass it by in the setting
of the regex flags.  Patch after sig.

Jeff "japhy" Pinyan
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk?
Perl Programmer at RiskMetrics Group, Inc.
Acacia Fraternity, Rensselaer Chapter.         Brother #734
**      Manning Publications, Co, is publishing my Perl Regex book      **

--- toke.c.old	Sun Jul  8 20:03:52 2001
+++ toke.c	Wed Jul 11 14:50:36 2001
@@ -6217,8 +6217,10 @@
     if (PL_multi_open == '?')
 	pm->op_pmflags |= PMf_ONCE;
     if(type == OP_QR) {
-	while (*s && strchr("iomsx", *s))
-	    pmflag(&pm->op_pmflags,*s++);
+	while (*s && strchr("iomsx", *s)) {
+	    if (*s != 'o') pmflag(&pm->op_pmflags,*s);
+	    s++;
+	}
     else {
 	while (*s && strchr("iogcmsx", *s))

--- pod/perlop.pod.old	Wed Jul 11 14:53:58 2001
+++ pod/perlop.pod	Wed Jul 11 14:55:20 2001
@@ -1032,12 +1032,13 @@
     i	Do case-insensitive pattern matching.
     m	Treat string as multiple lines.
-    o	Compile pattern only once.
+    o	Compile pattern only once (a no-op for qr// objects).
     s	Treat string as single line.
     x	Use extended regular expressions.
 See L<perlre> for additional information on valid syntax for STRING, and
-for a detailed look at the semantics of regular expressions.
+for a detailed look at the semantics of regular expressions.  Because a
+C<qr//> object is precompiled, the C</o> modifier is a no-op.
 =item qx/STRING/

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About