From: Graham Knop Date: Thu, 20 Jun 2013 10:59:03 +0000 (-0400) Subject: fix compatibility with subclasses that override apply_single_role_to_package X-Git-Tag: v1.003000~16 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ee81e66380fca54fd8c8bd152deaa337b83944b2;p=gitmo%2FRole-Tiny.git fix compatibility with subclasses that override apply_single_role_to_package --- diff --git a/lib/Role/Tiny.pm b/lib/Role/Tiny.pm index 78147a5..4de4f33 100644 --- a/lib/Role/Tiny.pm +++ b/lib/Role/Tiny.pm @@ -79,6 +79,7 @@ sub role_application_steps { sub apply_single_role_to_package { my ($me, $to, $role) = @_; + return if our $SKIP_APPLY; _load_module($role); @@ -200,6 +201,12 @@ sub apply_roles_to_package { $me->$step($to, $role); } } + # backcompat: allow subclasses to use apply_single_role_to_package + # to apply changes. set a local var so ours does nothing. + local our $SKIP_APPLY = 1; + foreach my $role (@roles) { + $me->apply_single_role_to_package($to, $role); + } $APPLIED_TO{$to}{join('|',@roles)} = 1; }