develooper Front page | perl.perl5.porters | Postings from October 2015

Re: [perl #126185] /(?-p)/ should be an error

Thread Previous | Thread Next
From:
demerphq
Date:
October 7, 2015 11:34
Subject:
Re: [perl #126185] /(?-p)/ should be an error
Message ID:
CANgJU+X3LJ8BdenmQ3PoeAcJNT1Q-izx6z54uyXKDj+TKYzDZw@mail.gmail.com
On 25 September 2015 at 19:03, Victor ADAM <perlbug-followup@perl.org> wrote:
> # New Ticket Created by  Victor ADAM
> # Please include the string:  [perl #126185]
> # in the subject line of all future correspondence about this issue.
> # <URL: https://rt.perl.org/Ticket/Display.html?id=126185 >
>
>
> This is a bug report for perl from victor.adam@derpymail.org,
> generated with the help of perlbug 1.40 running under perl 5.23.4.
>
>
> -----------------------------------------------------------------
> [Please describe your issue here]
>
> How to reproduce
> ----------------
>
>> perl5.23.4 -e '/(?-p)/p; print defined for ${^MATCH}, ${^PREMATCH}, ${^POSTMATCH}'
>
> Expected behavior
> -----------------
>
> Perl should die with the following diagnostic:
>
>> Regexp modifier "p" may not appear after the "-" in regex; marked by <-- HERE in m/(?-p <-- HERE )/ at -e line 1.

I dont know that I agree that Perl should die. We warn instead:

$ ./perl -we'qr/(?-p)foo/'
Useless use of (?-p) in regex; marked by <-- HERE in m/(?-p <-- HERE
)foo/ at -e line 1.

Given the mild consequences of this type of mistake I think warnings
are sufficient.

Unless someone strongly disagrees I would like  to close this ticket
as "wont fix".

Thanks for the report though!

Yves

Yves

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