Skip Menu |

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

Report information
The Basics
Id: 75797
Status: open
Priority: 0/
Queue: Regexp-Grammars

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

Bug Information
Severity: Critical
Broken in:
  • 1.013
  • 1.016
Fixed in: (no value)



Subject: builtin 'split' broken
When using Regexp::Grammars the builtin 'split' ceases functioning correctly. I tested this with version 1.013 and 1.016 on Linux and 1.016 on Windows. Perl version (Platform) on which error was noticed: Strawberry Perl 5.12.3 on Windows 7 (perl 5, version 12, subversion 3 (v5.12.3) built for MSWin32-x86-multi-thread) Perl 5.14.1 on Red Hat (perl 5, version 14, subversion 1 (v5.14.1) built for x86_64-linux)
Subject: regexp_grammars_breaks_split.pl
use strict; use warnings; my @test0 = split /A/, "BABAC"; print join("\t", @test0) . "\n"; # Works use Regexp::Grammars; my @test1 = split /A/, "BABAC"; print join("\t", @test1) . "\n"; # Does not work no Regexp::Grammars; my @test2 = split /A/, "BABAC"; print join("\t", @test2) . "\n"; # Works
Subject: Re: [rt.cpan.org #75797] builtin 'split' broken
Date: Fri, 16 Mar 2012 07:30:02 +1100
To: bug-Regexp-Grammars [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Show quoted text
> When using Regexp::Grammars the builtin 'split' ceases functioning > correctly.
This is indeed the case. Basically split() is never going to work correctly with RG, because RG injects extra captures into every regex in order to do its work. I will look at patching RG so that it detects "plain" regexes like your example, and does not rewrite them. I will also either document the incompatibility, or fix it somehow (probably by overriding split() itself). Meanwhile the workaround is: my @test1 = do { no Regexp::Grammars; split /A/, "BABAC" }; Thanks for this important bug report. Damian