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

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

Thread Next
From:
Jeff 'japhy' Pinyan
Date:
July 11, 2001 11:57
Subject:
[PATCH toke.c pod/perlop.pod] qr//o <-- no-op
Message ID:
Pine.GSO.4.21.0107111456270.7766-100000@crusoe.crusoe.net
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      japhy@pobox.com      http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk?  http://www.perlmonks.com/     http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc.     http://www.riskmetrics.com/
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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About