in reply to Re^3: Moose again...Debugging?
in thread Moose again...Debugging?

I guess I should have made the MooseX::Declare part more obvious, sorry about that. I'm not defining the new method, so it's not a double definition.

I'll play with the -MO=Deparse. What does this do exactly? It's not something I've used before. I do get a message that the syntax is ok.

Replies are listed 'Best First'.
Re^5: Moose again...Debugging?
by stvn (Monsignor) on Dec 20, 2010 at 01:12 UTC
    I guess I should have made the MooseX::Declare part more obvious ...

    Honestly, I guessed it from the issue you were having, but yeah specifying that will help others to help you.

    Moose is one module and MooseX::Declare is another one entirely with it's own "unique" programming experience. I personally still don't feel that MooseX::Declare is ready for production. A good number of people use it and seem to not have many issues, however a good number of people find it to be touchy and prone to breakages and has horrendous error messages (all of which are being worked on, but are non-trivial tasks).

    I would second duelafn's recommendation and switch back to vanilla Moose, you will find that beyond simply syntactic sugar, you are only missing method param validation which can be accomplished (although somewhat less elegantly) will MooseX::Params::Validate.

    -stvn
Re^5: Moose again...Debugging?
by Anonymous Monk on Dec 18, 2010 at 21:02 UTC
    It shows the representation of the code after it's been parsed.

    From the B::Deparse documentation:

    B::Deparse is a backend module for the Perl compiler that generates perl source code, based on the internal compiled structure that perl itself creates after parsing a program. The output of B::Deparse won't be exactly the same as the original source, since perl doesn't keep track of comments or whitespace, and there isn't a one-to-one correspondence between perl's syntactical constructions and their compiled form, but it will often be close. When you use the -p option, the output also includes parentheses even when they are not required by precedence, which can make it easy to see if perl is parsing your expressions the way you intended.

    An explanation on why the O module is used, from a response to "B::Deparse vs. O=Deparse":

    B::Deparse loads functions to deparse Perl code. But since you never use the module, it's rather useless to load the module.

    O, on the other hand, behaves very specially when loaded. It loads the program, dumps it using the specified dumper (e.g B::Deparse), and prevents it from executing as if -c had been specified.

Re^5: Moose again...Debugging?
by Anonymous Monk on Dec 18, 2010 at 21:13 UTC
    $ perl -MO=Deparse,-p -e" die warn print " die(warn(print($_))); -e syntax OK