restricted code
[gitmo/Role-Tiny.git] / lib / Role / Tiny / Restricted.pm
1 package Role::Tiny::Restricted;
2
3 use strict;
4 use warnings FATAL => 'all';
5 use base qw(Role::Tiny);
6
7 sub apply_union_of_roles_to_package {
8   my ($me, $to, @roles) = @_;
9   my %app = %{$Role::Tiny::APPLIED_TO{$to}||{}};
10   delete $app{$to};
11   if (%app) {
12     require Carp;
13     Carp::confess("with() may not be called more than once for $to");
14   }
15   $me->SUPER::apply_union_of_roles_to_package($to, @roles);
16 }
17
18 1;