File Coverage

blib/lib/Moxie/Object.pm
Criterion Covered Total %
statement 22 23 95.6
branch 5 6 83.3
condition 2 3 66.6
subroutine 6 6 100.0
pod 1 1 100.0
total 36 39 92.3


line stmt bran cond sub pod time code
1             package Moxie::Object;
2             # ABSTRACT: Yet Another Base Class
3              
4 49     49   584 use v5.22;
  49         153  
5 49     49   244 use warnings;
  49         85  
  49         1632  
6 49         336 use experimental qw[
7             signatures
8             postderef
9 49     49   247 ];
  49         97  
10              
11 49     49   8085 use UNIVERSAL::Object;
  49         135  
  49         3801  
12              
13             our $VERSION = '0.07';
14             our $AUTHORITY = 'cpan:STEVAN';
15              
16 49     49   8318 our @ISA; BEGIN { @ISA = ('UNIVERSAL::Object') }
17              
18 31     31 1 22808 sub DOES ($self, $role) {
  31         56  
  31         46  
  31         39  
19 31   66     101 my $class = ref $self || $self;
20             # if we inherit from this, we are good ...
21 31 100       171 return 1 if $class->isa( $role );
22             # next check the roles ...
23 21         92 my $meta = MOP::Class->new( name => $class );
24             # test just the local (and composed) roles first ...
25 21 100       1212 return 1 if $meta->does_role( $role );
26             # then check the inheritance hierarchy next ...
27 1 50       176 return 1 if scalar grep { MOP::Class->new( name => $_ )->does_role( $role ) } $meta->mro->@*;
  4         398  
28 0           return 0;
29             }
30              
31             1;
32              
33             __END__