Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Perl-Critic CPAN distribution.

Report information
The Basics
Id: 67142
Status: new
Priority: 0/
Queue: Perl-Critic

Owner: Nobody in particular
Requestors: EDAVIS [...]

Bug Information
Severity: Wishlist
Broken in: 1.114
Fixed in: (no value)

Subject: Suggested policy: forbid /o regexp flag
Download (untitled) / with headers
text/plain 748b
In the old days, you could put the /o flag on a regexp using interpolated variables to indicate it should be compiled just once. Nowadays the regexp compilation is memoized by the perl runtime, so if the interpolated string hasn't changed, there is very little speed penalty. On the other hand, /o can introduce a bug if the string *has* changed for some reason. (If you really want to get the interpolated string once and then save it for future matches, even though variables may have changed, then there are clearer ways to express this than using the /o flag.) See <> for background. Perl::Critic should have a policy at medium severity discouraging the use of /o on regexps.

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to