Quick disclaimer: I don't use MooseX::Declare personally and I never have, the level of sugar never appealed to me. That said ....

Honestly, I think the answer is to stop using MooseX::Declare.

After I saw your nopaste on #moose last night, I was looking over MX::Declare and noticed that no major work has really been done on it in over a year. It is and has always been *highly* experimental and it is only recommend for production use if you are willing to deal with some of it's fragility and odd edge cases.

This in contrast to plain Moose which is very *VERY* stable and for which inheritance always Just Works.

Maybe it is not as sexy, but if that is what you want, I recommend Ruby ;)

- Stevan



On Jan 22, 2011, at 3:07 PM, Rick Apichairuk wrote:


-----Original Message-----
From: Nick Perez [mailto:n...@nickandperla.net]
Sent: Saturday, January 22, 2011 2:47 AM
To: Rick Apichairuk
Cc: moose@perl.org
Subject: Re: Inheritance not working for some weird reason.

Hey Rick,

So I had at look at your code and cleaned it up some what and made it run within a single file. In the future, please refrain from large examples.
It really
helps people to see your problem better if you can make a very small, very
succinct test.

From what I can see, this runs without problem. I did have to change the
'BAD' tests at the bottom to account for the proper values.


I tried your version and it did work. However, this code was intended to be
in separate packages and that is when the error occurs. Did you run my
version (in separate class files) and did it work for you?

What versions of MooseX::Declare, Devel::Declare,
MooseX::Method::Signatures, Moose, Class::MOP, and perl are you running
where this is a problem?

I have asked 3 other people to run the code and everyone experiences the
same problem. We all have varying versions of Moose, MooseX::Declare,
Devel::Declare, etc.

On my own machine, I am using the following versions:

This is perl, v5.10.1 (*) built for i686-linux-gnu-thread-multi
Moose 1.21
MooseX::Declare 0.32
Devel::Declare 0.006000
MooseX::Method::Signatures 0.34
Class::MOP 1.11

I had thought it might have been the new lines in
your class declaration that were the issue, but it still runs without
issue on my
end even with the newlines. My other thought is perhaps the double
package declarations. You do realize that this:

package Foo;

use MooseX::Declare;

class Foo {...}

is essentially doing this:

package Foo;
use MooseX::Declare;
{ package Foo; ... }

right? I know I've had some trouble with Roles in the past where double
declarations of the package has caused issues. If you really want the
package
declaration, I suggest scoping it with braces (this is what I've done when
publishing modules to CPAN, so that it runs with the current CPAN
toolset).

Thanks, I'll definitely keep this in mind in the future.

Rick


Reply via email to