Subject: | Segfault with Regexp::Grammars |
The following program produces a segmentation fault:
#!/usr/bin/perl
use MooseX::Declare;
my $gr = do {
use Regexp::Grammars;
qr {
<Foo>
<objrule: Foo>
foo
}x;
};
class Foo {
method BUILD {
}
}
my $m = 'foo' =~ $gr
or die 'no match';
Sorry I could not reproduce this without using Regexp::Grammars, so I am
not 100% sure this is a bug in your module. The grammar calls the "Foo"
constructor upon matching a "foo" string.
The problem only appears if there is a BUILD method. If I create the
"Foo" class with plain Moose, there is no segfault.
I'd very much appreciate a fix (or workaround) because it would be nice
to be able to use these modules together.
Regexp::Grammars is available on CPAN. I used the current version 1.012
of that module, together with perl 5.10.1.