develooper Front page | perl.perl5.porters | Postings from December 2011

Re: [perl #107262] Unmatched \Q \E in regexp should warn

Thread Previous | Thread Next
From:
demerphq
Date:
December 29, 2011 23:44
Subject:
Re: [perl #107262] Unmatched \Q \E in regexp should warn
Message ID:
CANgJU+VTc9Uhd3REJfk7pccV4SUCj9u+99bgxH=YUMnZgGTSXQ@mail.gmail.com
On 30 December 2011 05:14, Brian Fraser <fraserbn@gmail.com> wrote:
> On Thu, Dec 29, 2011 at 10:59 AM, Ricardo Signes <perl.p5p@rjbs.manxome.org>
> wrote:
>>
>> * demerphq <demerphq@gmail.com> [2011-12-29T06:08:49]
>> > This construct is not regexp specific, and does not warn in other
>> > situations.
>> >
>> > perl -le'my $x="\Qfoo[]"; print $x'
>> > foo\[\]
>> >
>> > IMO, not-a-bug.
>>
>> Warning on an unmatched \E might make sense.  I'm not sure.
>
>
> The attached patch does this. Currently the warning is "Found \E without a
> preceding case modification or quoted section", mostly because I felt
> particularly unimaginative. No comment on whenever making this warn is a
> warranted change or not, but to add another data point, it just brought to
> light a bug in Pod::Simple: Pod::Simple::Text is using \E where it probably
> meant \Q

FWIW, I have no objection to a lone \E warning.

Yves


-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

Thread Previous | 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