Skip Menu |

This queue is for tickets about the Regexp-Debugger CPAN distribution.

Report information
The Basics
Id: 80393
Status: resolved
Priority: 0/
Queue: Regexp-Debugger

People
Owner: Nobody in particular
Requestors: KSURI [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 0.001010
  • 0.001011
Fixed in: (no value)



Subject: Regexp::Debugger breaks regular expression
Basically, Regexp::Debugger adds an unmatched closing parenthesis. See attachments for details. test.pl — script to reproduce error perl.info — my perl -V output output — huge error message
Subject: test.pl
#!/usr/bin/env perl use v5.14; use Data::Dumper; use Regexp::Debugger; my $grammar = qr/ \A (?&query) \z (?(DEFINE) (?<query> (?&return) (?&delimiter) (?&expression) ) (?<return> (?&column_index) (?: (?&separator) (?&return) )* ) (?<expression> (?&column_index) (?&op) (?&literal) (?: (?&separator) (?&expression) )* ) (?<delimiter> [#] ) (?<separator> , ) (?<column_index> [0-9] (?![0-9]) ) (?<literal> [0-9]+ ) (?<conjuction> [&|] ) (?<op> [<>!=] ) ) /x; my $in = '0,1,2#2<250&3>103000&4=105090&5!30000'; $in =~ /($grammar)/; print Dumper(\%-, \%+);
Subject: output
Download output
application/octet-stream 93.2k

Message body not shown because it is not plain text.

Subject: perl.info
Download perl.info
application/octet-stream 2.6k

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #80393] Regexp::Debugger breaks regular expression
Date: Fri, 26 Oct 2012 08:12:03 +1100
To: bug-Regexp-Debugger [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
This is a known (and documented) limitation of the module. It is schedule to be removed in a future version of the module, but that may be some time off yet. From the docs: Variable interpolations The module handles the interpolation of strings correctly, expanding them in-place before debugging begins. However, it currently does not correctly handle the interpolation of "qr"'d regexes. That is, this: use Regexp::Debugger; my $ident = qr{ [^\W\d]\w* }x; # a qr'd regex... $str =~ m{ ($ident) : (.*) }xms; # ...interpolated into another regex does not work correctly...and usually will not even compile. In this case, change: $in =~ /($grammar)/; to: $in =~ $grammar; as a work-around. Damian