Skip Menu |

This queue is for tickets about the MooseX-ABC CPAN distribution.

Report information
The Basics
Id: 48566
Status: open
Priority: 0/
Queue: MooseX-ABC

People
Owner: Nobody in particular
Requestors: onken [...] netcubed.de
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.02
Fixed in: (no value)



Subject: Doesn't work with MooseX::Declare
Hi, MooseX::ABC doesn't seem to wokr with classes which were defined using MooseX::Declare.
Hello, just a note to signal that I'm interested in this issue too
I don't use MooseX::Declare, so I'm going to need a little more information than "it doesn't work". What exactly is broken?
Am Sa 26. Dez 2009, 01:00:04, DOY schrieb:
Show quoted text
> I don't use MooseX::Declare, so I'm going to need a little more information
> than "it doesn't work". What exactly is broken?

use MooseX::Declare;
 
class Foo {
    use MooseX::ABC;
    
    requires 'abc';
}
 
class Bar extends Foo {
    method abc() {}
    
}

this this simple example gives me the following error message:

"Foo requires Bar to implement abc "

If I write sub abc {} instead of method aba(){} it seems to work.



I've just released MooseX::ABCD which works like MooseX::ABC but plays nicer with MooseX::Declare. The difficulty with the way MooseX::ABC works is that it checks that required methods have been implemented by derived classes when the inheritance is set up. However, MooseX::Declare sets up inheritance *before* processing the body of the class, thus none of the class' methods are defined yet. MooseX::ABCD fixes this by deferring the check for required methods until the derived class is made immutable. This allows it work with MooseX::Declare. It also means that MooseX::ABCD has a bug (or perhaps feature?) that if a class is mutable, the 'requires' checks do not happen. However, MooseX::Declare makes classes mutable by default.