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   623 use v5.22;
  49         173  
5 49     49   257 use warnings;
  49         100  
  49         1765  
6 49         321 use experimental qw[
7             signatures
8             postderef
9 49     49   261 ];
  49         90  
10              
11 49     49   8861 use UNIVERSAL::Object;
  49         118  
  49         4088  
12              
13             our $VERSION = '0.06';
14             our $AUTHORITY = 'cpan:STEVAN';
15              
16 49     49   9348 our @ISA; BEGIN { @ISA = ('UNIVERSAL::Object') }
17              
18 31     31 1 32783 sub DOES ($self, $role) {
  31         68  
  31         57  
  31         48  
19 31   66     128 my $class = ref $self || $self;
20             # if we inherit from this, we are good ...
21 31 100       230 return 1 if $class->isa( $role );
22             # next check the roles ...
23 21         123 my $meta = MOP::Class->new( name => $class );
24             # test just the local (and composed) roles first ...
25 21 100       1689 return 1 if $meta->does_role( $role );
26             # then check the inheritance hierarchy next ...
27 1 50       245 return 1 if scalar grep { MOP::Class->new( name => $_ )->does_role( $role ) } $meta->mro->@*;
  4         518  
28 0           return 0;
29             }
30              
31             1;
32              
33             __END__