use strict;
use warnings FATAL => 'all';
-our $VERSION = '1.001002'; # 1.1.2
+our $VERSION = '1.001005'; # 1.1.5
$VERSION = eval $VERSION;
our %INFO;
} keys %conflicts;
die $fail;
}
- delete $INFO{$to}{methods}; # reset since we're about to add methods
+
+ # the if guard here is essential since otherwise we accidentally create
+ # a $INFO for something that isn't a Role::Tiny (or Moo::Role) because
+ # autovivification hates us and wants us to die()
+ if ($INFO{$to}) {
+ delete $INFO{$to}{methods}; # reset since we're about to add methods
+ }
+
$me->apply_role_to_package($to, $_) for @roles;
$APPLIED_TO{$to}{join('|',@roles)} = 1;
}
my $stash = do { no strict 'refs'; \%{"${role}::"}};
# reverse so our keys become the values (captured coderefs) in case
# they got copied or re-used since
- my $not_methods = { reverse %{$info->{not_methods}} };
+ my $not_methods = { reverse %{$info->{not_methods}||{}} };
$info->{methods} ||= +{
# grab all code entries that aren't in the not_methods list
map {
sub does_role {
my ($proto, $role) = @_;
- return exists $APPLIED_TO{ref($proto)||$proto}{$role};
+ if ($] >= 5.010) {
+ require mro;
+ } else {
+ require MRO::Compat;
+ }
+ foreach my $class (@{mro::get_linear_isa(ref($proto)||$proto)}) {
+ return 1 if exists $APPLIED_TO{$class}{$role};
+ }
+ return 0;
}
1;
Mithaldu - Christian Walde (cpan:MITHALDU) <walde.christian@googlemail.com>
+ilmari - Dagfinn Ilmari Mannsåker (cpan:ILMARI) <ilmari@ilmari.org>
+
=head1 COPYRIGHT
Copyright (c) 2010-2012 the Role::Tiny L</AUTHOR> and L</CONTRIBUTORS>