lib/Mojo/Role.pm

filter: Statementstmt 95.6% 22 / 23 Branchbran 100% 2 / 2 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 83.3% 5 / 6 Podpod n/a totaltotal 88.8% 32 / 36 CC 3 SCAR 5.7
CC
3
Cov
93%
import
3.0
has
1.1
BEGIN
1.0
CRAP 1.8
↑ Summary
1 package Mojo::Role;
2  
3 # imports
4 2 ▶use Mojo::Base -strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use Role::Tiny ();
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use Role::Tiny::With ();
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use Mojo::Util ();
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 # version
10 2 our $VERSION = '0.999';
11  
12 5 ▶sub import {
Subroutine import: called CC=3 SCAR=11.1
13 # caller is a consumer, import with
14 # it is assumed that the caller's Mojo::Base imported strict already
15 5 ▶ if (@_ > 1 and $_[1] eq '-with') {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ > 1 and $_[1] eq "-with") 1 4 5
Condition66%2/3
@_ > 1 and $_[1] eq "-with"
!ll&&!rl&&r
401
MC/DC50%1/2
@_ > 1 and $_[1] eq "-with"
@_ > 1 $_[1] eq "-with"
Truth table66%2/3
A and B
A= @_ > 1B= $_[1] eq "-with"
ABresult
0X0
100
111
16 1 @_ = 'Role::Tiny::With';
17 1 goto &Role::Tiny::With::import;
18 }
19  
20 # the caller is a role
21 # roles are strict
22 4 Mojo::Base->import('-strict');
23 4 my $target = caller;
24 0 ▶ Mojo::Util::monkey_patch $target, has => sub { Mojo::Base::attr($target, @_) };
Subroutine has: not called CC=1 SCAR=1.2
25  
26 4 @_ = 'Role::Tiny';
27 4 goto &Role::Tiny::import;
28 }
29  
30 2 1;
31 __END__
↑ Summary