lib/Mojo/RoleTiny.pm

filter: Statementstmt 92.3% 24 / 26 Branchbran 100% 2 / 2 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 71.4% 5 / 7 Podpod n/a totaltotal 85.0% 34 / 40 CC 3 SCAR 5.6
CC
3
Cov
90%
import
3.1
__ANON__
1.3
has
1.3
CRAP 1.8
« blib/lib/Mojo/example.pl ↑ Summary
1 package Mojo::RoleTiny;
2  
3 # ABSTRACT: Mojo::RoleTiny - Tiny and simple role system for Mojo
4  
5 # imports
6 2 ▶use Mojo::Base -strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use Role::Tiny ();
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use Role::Tiny::With ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use Mojo::Util ();
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 # version
12 1 our $VERSION = 0.022;
13  
14 5 ▶sub import {
Subroutine import: called CC=3 SCAR=11.2
15 # caller is a consumer, import with
16 # it is assumed that the caller's Mojo::Base imported strict already
17 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
18 1 @_ = 'Role::Tiny::With';
19 1 goto &Role::Tiny::With::import;
20 }
21  
22 # the caller is a role
23 # roles are strict
24 4 Mojo::Base->import('-strict');
25 4 my $target = caller;
26 0 ▶ Mojo::Util::monkey_patch $target, has => sub { Mojo::Base::attr($target, @_) };
Subroutine has: not called CC=1 SCAR=2.6
Subroutine __ANON__: not called CC=1 SCAR=2.6
27  
28 4 @_ = 'Role::Tiny';
29 4 goto &Role::Tiny::import;
30 }
31  
32 1 1;
33 __END__
« blib/lib/Mojo/example.pl ↑ Summary