Rolf,

Once the the role is applied to the PW::Base it cannot be unapplied or replaced, it has been composed into PW::Base for good.

I think perhaps you don't want to apply PW::RoleA to PW::Base, but perhaps move that higher up the inheritance chain so it wont conflict with the 'PW::Site::Xy::RoleA'.

Not much more advice I can give beyond that as I am not sure what your problem domain actually is.

- Stevan


On Jun 17, 2009, at 12:47 PM, Rolf Schaufelberger wrote:

Hi,

I would like to be able to replace a role in subclass :

When  I have  a class and a Role

package   PW::Base ;

with 'PW::RoleA';

...
;
==========
package PW::RoleA;

..
after calc => sub {.. };

==========
AND and subclass of PW::Base where I want to have another calc method,
so I have another Role for it:

package PW::Site::Xy::Base;
extends PW::Base;

with 'PW::Site::Xy::RoleA'

...

AND

PW::Site::Xy::RoleA
excludes 'PW::RoleA';
..
after calc => sub {.. };

==========

now I get the error:

The class PW::Site::Xy::Base  does the excluded role 'PW::RoleA'

So what am I doing wrong ?


Rolf Schaufelberger






Reply via email to