blib/lib/MooX/ShortHas.pm

filter: Statementstmt 100% 24 / 24 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod n/a totaltotal 100% 33 / 33 CC 3 SCAR 5.1
CC
3
Cov
100%
import
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.7
↑ Summary
1 package MooX::ShortHas;
2  
3 3 ▶use strictures 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 2 our $VERSION = '1.202040'; # VERSION
6  
7 # ABSTRACT: shortcuts for common Moo has attribute configurations
8  
9 #
10 # This file is part of MooX-ShortHas
11 #
12 #
13 # Christian Walde has dedicated the work to the Commons by waiving all of his
14 # or her rights to the work worldwide under copyright law and all related or
15 # neighboring legal rights he or she had in the work, to the extent allowable by
16 # law.
17 #
18 # Works under CC0 do not require attribution. When citing the work, you should
19 # not imply endorsement by the author.
20 #
21  
22  
23 3 ▶use Moo 2.003006 ();
Subroutine BEGIN: called CC=1 SCAR=0.0
24 3 ▶use Moo::_Utils qw(_install_tracked);
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 8 ▶sub _modified_has {
Subroutine _modified_has: called CC=1 SCAR=0.0
27 8 my ( $has, $mod, $name, @args ) = @_;
28 8 $has->( $name, @{$mod}, @args );
29 }
30  
31 4 ▶sub import {
Subroutine import: called CC=3 SCAR=11.0
32 4 my $caller = caller;
33 4 ▶ my $has = $caller->can( "has" ) or die "Moo not loaded in caller: $caller";
Branch: 1 branch
BranchTrueFalseTotal
my $has = $caller->can("has") or die "Moo not loaded in caller: $caller" 3 1 4
34 my %mods = (
35 lazy => [qw( is lazy builder )],
36 3 map { $_ => [ is => $_ => required => 1 ] } qw( ro rwp rw )
37 );
38 3 for my $mod ( keys %mods ) {
39 2 ▶ _install_tracked $caller => $mod => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine rwp: called CC=1 SCAR=0.0
40 2 _modified_has $has, $mods{$mod}, @_;
41 12 };
42 }
43 }
44  
45 2 1;
46  
47 __END__
↑ Summary