DeclareX/Plugin/having.pm

filter: Statementstmt 94.2% 33 / 35 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 9 / 9 Podpod 0.0% 0 / 2 totaltotal 88.0% 44 / 50 CC 3 SCAR 3.3
CC
3
Cov
90%
__ANON__
2.1
add_having_option_customizations
2.0
plugin_setup
1.0
CRAP 1.4
« DeclareX/Keyword/role.pm ↑ Summary DeclareX/Plugin/guard.pm »
1 package MooseX::DeclareX::Plugin::having;
2  
3 2 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 $MooseX::DeclareX::Plugin::having::AUTHORITY = 'cpan:TOBYINK';
5 2 $MooseX::DeclareX::Plugin::having::VERSION = '0.009';
6 }
7  
8 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 with 'MooseX::DeclareX::Plugin';
10  
11 2 ▶use MooseX::Declare ();
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶use Moose::Util ();
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 sub plugin_setup
15 5 ▶{
Subroutine plugin_setup: called CC=1 SCAR=0.2
Pod undocumented
16 5 my ($class, $kw) = @_;
17
18 5 Moose::Util::apply_all_roles(
19 $kw,
20 'MooseX::DeclareX::Plugin::having::Role',
21 );
22
23 MooseX::Declare::Context::WithOptions->meta->add_around_method_modifier(
24 5 ▶ allowed_option_names => sub {
Subroutine __ANON__: called CC=2 SCAR=7.6
25 5 my ($orig, $self, $x) = @_;
26 5 ▶ if ($x)
Branch: 1 branch
BranchTrueFalseTotal
if ($x) { } 0 5 5
27 {
28 0 push @$x, 'having';
29 0 return $self->$orig($x);
30 }
31 else
32 {
33 5 $x = $self->$orig();
34 5 push @$x, 'having';
35 5 return $x;
36 }
37 }
38 5 );
39 }
40  
41 package MooseX::DeclareX::Plugin::having::Role;
42  
43 2 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
44 2 $MooseX::DeclareX::Plugin::having::Role::AUTHORITY = 'cpan:TOBYINK';
45 2 $MooseX::DeclareX::Plugin::having::Role::VERSION = '0.009';
46 }
47  
48 2 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
49
50 sub add_having_option_customizations
51 2 ▶{
Subroutine add_having_option_customizations: called CC=2 SCAR=7.0
Pod undocumented
52 2 my ($self, $ctx, $package, $attribs) = @_;
53 2 my @code_parts;
54 push @code_parts, sprintf(
55 "has [%s] => (is => q/ro/, isa => q/Any/)\n",
56 join ', ',
57 2 map { "q/$_/" }
58 2 ▶ @{ ref $attribs ? $attribs : [$attribs] }
Branch: 1 branch
BranchTrueFalseTotal
ref $attribs ? : 2 0 2
59 );
60 2 $ctx->add_scope_code_parts(@code_parts);
61 2 return 1;
62 }
63  
64 2 1;
« DeclareX/Keyword/role.pm ↑ Summary DeclareX/Plugin/guard.pm »