Another issue:

Can parameter use builder and have it defined within the same module?

I've tried

parameter foo => (is => 'rw', builder => '_foo');

with _foo() defined above this statement, below it, inside the role block (pretty sure it fails before getting inside the role). No good. It says: Error: Class::MOP::Class::__ANON__::SERIAL::1 does not support builder method ...

What should I do?

On Apr 22, 2010, at 2:54 PM, Kate Yoak wrote:

Just a couple of notes that would be of use if they were in the documentation:

1. The bad news: Because of the weirdness of role{} block, the child, nor the role cannot be declared within the same file with the script. (Like you might do while trying to test sample functionality!) 2. The good news: You can declare regular attr and methods outside of the role block (only parameterized declarations need to be there)

 e.g. the following orphaned role is legal:

package Role;
use MooseX::Role::Parameterized;

has name => (is => 'rw');

role{};

1;

The usefulness is in the realization that not the entirety of the role must belong in the role {} block - but just the parameterized part.

That said, I am very excited about the functionality! Thanks!


Reply via email to