Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: Segfault with MooseX::Declare and Regexp::Grammars

by ELISHEVA (Prior)
on Feb 27, 2011 at 13:12 UTC ( #890411=note: print w/replies, xml ) Need Help??

in reply to Segfault with MooseX::Declare and Regexp::Grammars

Maybe you can help me pinpoint the origin of this bug.

Have you tried rewriting your program to use plain old Perl objects (no Moose::Declare)? Do you still get a segfault?

If not, then I'd start looking at Moose::Declare, beginning with the smallest possible grammar ( can you have a null grammar qr{} - what happens when you do?) and building up until you see the weird behavior. Try each grammar out with your pure Perl object and with a Moose object, noting when both fail, one fails or the other fails.

If you can reproduce the problem without MooseX::Declare then either something about the way you are using Regexp::Grammars is at issue, or as you say, there is a bug.

  • Comment on Re: Segfault with MooseX::Declare and Regexp::Grammars

Replies are listed 'Best First'.
Re^2: Segfault with MooseX::Declare and Regexp::Grammars
by betterworld (Curate) on Feb 27, 2011 at 13:24 UTC
    Have you tried rewriting your program to use plain old Perl objects (no Moose::Declare)

    As stated above, the issue disappears when I get rid of MooseX::Declare and use plain Moose or even plain objects like this:

    { package Foo; sub new { use Data::Dumper; print 'AH ', Dumper \@_; return bless {}; } }
    can you have a null grammar qr{}

    I need the "objrule" to have Regexp::Grammars call the constructor, so the grammar cannot be reduced much further.

      If plain Perl objects and plain Moose objects don't cause this problem, could you clarify further what you are trying to pinpoint. What makes you unsure that this isn't an issue with MooseX::Declare and whatever magic it is conjuring up?

      It would seem to me that newer add-on packages like MooseX::Declare have a responsibility to work cleanly with core packages like Data::Dumper, as well as any non-core packages they extend (i.e. Moose). This is all the more so with something like MooseX::Declare which claims to be a safer way of doing the kinds of things people once tried to do with source filters.

        You are right that it is likely that the bug is in MooseX::Declare or one of its dependencies. I would like to find a way to reproduce this without resorting to other complicated modules like Regexp::Grammars (even though this module is pure Perl).

        Update: Other segmentation faults have already been described that are triggered by RGís extensive use of the regex engine, so itís not that unlikely that the culprit is in the regex engine.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://890411]
[stevieb]: use metamod::DateTime. Don't fsck around. Seriously. As someone who's done sensitive date/time stuff, don't roll your own. Use what is available and known stable. Do not guess.
[stevieb]: Date::Time even
[stevieb]: ffs I can't make DateTime link properly, so there.

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2017-04-29 04:17 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (531 votes). Check out past polls.