Or perhaps "ensure_all_roles_are_applied"?

On Apr 14, 2009, at 10:34 AM, Todd Hepler wrote:

Hans Dieter Pearcey wrote:
I added a note in the Moose::Meta::Role documentation yesterday to the effect that applying a role did not do any checks to make sure that the target had not
already consumed the role you were attempting to apply.
I always find myself writing "apply role unless does role".
Would anyone object to this functionality being in Moose::Util?  e.g.
 apply_all_missing_roles(
   $obj, "My::First::Role", "Another::Role::With::A::Long::Name"
 );
(replace 'missing' with some more appropriate term if one exists)

If something like that were to be added, I might call it ensure_roles_applied().


--
Todd Hepler
Informatics -- LIMS

Reply via email to