Role-Basic icon indicating copy to clipboard operation
Role-Basic copied to clipboard

apply_roles_to_package(): should it be possible even after 'with' has run?

Open ghost opened this issue 14 years ago • 1 comments

See https://gist.github.com/766303 - maybe that's just a 'role-antipattern', but I don't know of a better way to add capabilities to classes based on a configuration setting.

ghost avatar Jan 07 '11 11:01 ghost

The reason you can't do it after 'with' has run is that you lose the composition safety and that violates the entire spirit of what Role::Basic is trying to do. Perhaps if PERL_ROLE_OVERRIDE_DIE is set it might be OK, but for now, I don't feel entirely comfortable with this.

Ovid avatar Jan 08 '11 09:01 Ovid