Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: Thomas.Eckardt [...] thockar.com
Cc:
AdminCc:

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



Subject: wrong parsing character classes and crash
Date: Sun, 19 Aug 2012 11:38:38 +0200
To: bug-Regexp-Debugger [...] rt.cpan.org
From: Thomas Eckardt <Thomas.Eckardt [...] thockar.com>
in every Perl build - so version independed - Regexp::Debugger causes the regex engine to fail if escaped [] are followed by any character range in a character class #!/usr/local/bin/perl use strict; 'aa' =~ /[\[\]a-z]+/o; exit; perl -MRegexp::Debugger test_re.pl failes with Invalid [] range ")-(" in regex; marked by <-- HERE in m/(?#R_d:0)(?>\A(?{Regexp::Debugger::_reset_debugger_state()})(?! ))|(?:(?{Regexp::Debugger::_report_event(0, 0, pos()); $^R })(?=)(?:(?{Regexp::Debugger::_report_event(0, 1, pos()); $^R })(?=)[\[\](?{Regexp::Debugger::_report_event(0, 2, pos()); $^R })(?=)(?{Regexp::Debugger::_report_event(0, 3, pos()); $^R })(?=)a(?{Regexp::Debugger::_report_event(0, 4, pos()); $^R })(?=)-( <-- HERE ?{Regexp::Debugger::_report_event(0, 6 , pos()); $^R })(?=)z(?{Regexp: at test_re.pl line 4. Thomas Eckardt DISCLAIMER: ******************************************************* This email and any files transmitted with it may be confidential, legally privileged and protected in law and are intended solely for the use of the individual to whom it is addressed. This email was multiple times scanned for viruses. There should be no known virus in this email! *******************************************************
Subject: Re: [rt.cpan.org #79088] wrong parsing character classes and crash
Date: Sun, 19 Aug 2012 20:05:37 +1000
To: bug-Regexp-Debugger [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Thanks, Thomas. Fixed for the next release, which is currently uploading. :-) Damian
Subject: Antwort: [rt.cpan.org #79088] Resolved: wrong parsing character classes and crash
Date: Sun, 19 Aug 2012 12:51:15 +0200
To: bug-Regexp-Debugger [...] rt.cpan.org
From: Thomas Eckardt <Thomas.Eckardt [...] thockar.com>
Hi Damian, Show quoted text
>your request has been resolved
thank you for the quick fix! I would like to implement your great module in my project - ASSP-version 2 (http://sourceforge.net/projects/assp/) . ASSP uses (~160) regexes (the largest of them is currently ~ 45KB in size). To be more flexible, it would be nice, if someone could define an output variable , were the output is written to and if defined, no STDIN is requested by Regexp::Debugger anyway. I know, I can redirect STDOUT or do some other hacks to get the result like I want it - but it is more easy to do this simple in Regexp::Debugger. So Regexp::Debugge could be used similar to this: { my $myResult; my @results; use Regexp::Debugger ('outvar' => \$myResult , .......); .. Show quoted text
--- do any regex here --- push @results, $myResult; $myResult = '' .. --- do any regex here --- push @results, $myResult; } or possibly better using an array ref instead of a scalar ref - and getting back every single step-result in an array element - like: { my @results; use Regexp::Debugger ('outvar' => \@results , .......); ..
--- do any regex here --- my $myResult = join("\n", @results); .. } Btw. two questions: - is the namespace for Regexp::Debugger removed if it goes out of scope ? - is it possible to load Regexp::Debugger via eval('use Regexp::Debugger;') if (condition) or via the 'if' module use if (condition) Regexp::Debugger ? Thomas Von: "Damian_Conway via RT" <bug-Regexp-Debugger@rt.cpan.org> An: Thomas.Eckardt@thockar.com, Datum: 19.08.2012 12:16 Betreff: [rt.cpan.org #79088] Resolved: wrong parsing character classes and crash <URL: https://rt.cpan.org/Ticket/Display.html?id=79088 > According to our records, your request has been resolved. If you have any further questions or concerns, please respond to this message. DISCLAIMER: ******************************************************* This email and any files transmitted with it may be confidential, legally privileged and protected in law and are intended solely for the use of the individual to whom it is addressed. This email was multiple times scanned for viruses. There should be no known virus in this email! *******************************************************
Subject: Re: [rt.cpan.org #79088] Resolved: wrong parsing character classes and crash
Date: Mon, 20 Aug 2012 08:54:56 +1000
To: bug-Regexp-Debugger [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Show quoted text
> To be more flexible, it would be nice, if someone could define an output > variable , were the output is written to and if defined
That's what the 'save_to' option is for: my $var; my $fh; BEGIN{ open $fh, '>', \$var } use Regexp::Debugger save_to => $fh; 'ababab' =~ / (a|b) b+ c /x; use Data::Dumper 'Dumper'; warn Dumper [ $var ]; You get a full dump of the debugging process encoded in standard JSON. Or you can save directly to a disk file, such as: use Regexp::Debugger save_to => 'RD_dump.json'; and then use the rxrx utility that comes with the module to re-animate the JSON produced. Show quoted text
> Btw. two questions: > > - is the namespace for Regexp::Debugger removed if it goes out of scope ?
No. Show quoted text
> - is it possible to load Regexp::Debugger via eval('use > Regexp::Debugger;') if (condition) or via the 'if' module use if > (condition) Regexp::Debugger ?
That is not possible, since Regexp::Debugger is lexically scoped, so the effects would cease at the end of the eval'd string. Also, Regexp::Debugger requires a CHECK block, so it can't be loaded inside a string eval. Damian