lib/Catalyst/ClassData.pm

filter: Statementstmt 100% 304 / 304 Branchbran 95.6% 111 / 116 Conditioncond 66.6% 52 / 78 MC/DCmcdc 0.0% 0 / 52 Subroutinesub 100% 19 / 19 Podpod 100% 1 / 1 totaltotal 85.4% 487 / 570 CC 245 SCAR 20.6
CC
245
Cov
94%
__ANON__
8.0
__action_class_accessor
8.0
__action_role_prefix_accessor
8.0
CRAP 7.9
« lib/Catalyst/Test.pm ↑ Summary lib/Catalyst/Stats.pm »
1 package Catalyst::ClassData;
2  
3 171 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 171 ▶use Moose::Meta::Class ();
Subroutine BEGIN: called CC=1 SCAR=0.0
5 171 ▶use Class::MOP;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 171 ▶use Moose::Util ();
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 5187 ▶sub mk_classdata {
Subroutine mk_classdata: called CC=7 SCAR=19.5
Pod documented
9 5187 my ($class, $attribute, $warn_on_instance) = @_;
10 5187 ▶ confess("mk_classdata() is a class method, not an object method")
Branch: 1 branch
BranchTrueFalseTotal
if builtin::blessed($class) 0 5187 5187
11 if blessed $class;
12  
13 5187 my $slot = '$'.$attribute;
14 9466 ▶ my $accessor = sub {
Subroutine _dispatcher_class_accessor: called CC=8 SCAR=20.8
Subroutine __encode_check_accessor: called CC=8 SCAR=20.8
Subroutine __plugins_accessor: called CC=8 SCAR=20.8
Subroutine _loading_psgi_file_accessor: called CC=8 SCAR=20.8
Subroutine _stats_class_traits_accessor: called CC=8 SCAR=20.8
Subroutine _stats_class_accessor: called CC=8 SCAR=20.8
Subroutine _components_accessor: called CC=8 SCAR=20.8
Subroutine __ANON__: called CC=8 SCAR=20.8
Subroutine _context_class_accessor: called CC=8 SCAR=20.8
Subroutine _response_class_accessor: called CC=8 SCAR=20.8
Subroutine __data_handlers_accessor: called CC=8 SCAR=20.8
Subroutine __encoding_accessor: called CC=8 SCAR=20.8
Subroutine _run_options_accessor: called CC=8 SCAR=20.8
15 9466 ▶ my $pkg = ref $_[0] || $_[0];
Condition66%26/39
ref $_[0] || $_[0]
l!l&&r!l&&!r
422552410
ref $_[0] || $_[0]
l!l&&r!l&&!r
9117117200
ref $_[0] || $_[0]
l!l&&r!l&&!r
15920217130
ref $_[0] || $_[0]
l!l&&r!l&&!r
9629102240
ref $_[0] || $_[0]
l!l&&r!l&&!r
507287740
ref $_[0] || $_[0]
l!l&&r!l&&!r
8751153920
ref $_[0] || $_[0]
l!l&&r!l&&!r
10492189720
ref $_[0] || $_[0]
l!l&&r!l&&!r
13374157700
ref $_[0] || $_[0]
l!l&&r!l&&!r
32140271390
ref $_[0] || $_[0]
l!l&&r!l&&!r
6102100160
ref $_[0] || $_[0]
l!l&&r!l&&!r
12685208360
ref $_[0] || $_[0]
l!l&&r!l&&!r
18396183000
ref $_[0] || $_[0]
l!l&&r!l&&!r
195329920
MC/DC0%0/2
ref $_[0] || $_[0]
ref $_[0] $_[0]
MC/DC0%0/2
ref $_[0] || $_[0]
ref $_[0] $_[0]
MC/DC0%0/2
ref $_[0] || $_[0]
ref $_[0] $_[0]
MC/DC0%0/2
ref $_[0] || $_[0]
ref $_[0] $_[0]
MC/DC0%0/2
ref $_[0] || $_[0]
ref $_[0] $_[0]
MC/DC0%0/2
ref $_[0] || $_[0]
ref $_[0] $_[0]
MC/DC0%0/2
ref $_[0] || $_[0]
ref $_[0] $_[0]
MC/DC0%0/2
ref $_[0] || $_[0]
ref $_[0] $_[0]
MC/DC0%0/2
ref $_[0] || $_[0]
ref $_[0] $_[0]
MC/DC0%0/2
ref $_[0] || $_[0]
ref $_[0] $_[0]
MC/DC0%0/2
ref $_[0] || $_[0]
ref $_[0] $_[0]
MC/DC0%0/2
ref $_[0] || $_[0]
ref $_[0] $_[0]
MC/DC0%0/2
ref $_[0] || $_[0]
ref $_[0] $_[0]
Truth table66%2/3
A || B
A= ref $_[0]B= $_[0]
ABresult
1X1
011
000
Truth table66%2/3
A || B
A= ref $_[0]B= $_[0]
ABresult
1X1
011
000
Truth table66%2/3
A || B
A= ref $_[0]B= $_[0]
ABresult
1X1
011
000
Truth table66%2/3
A || B
A= ref $_[0]B= $_[0]
ABresult
1X1
011
000
Truth table66%2/3
A || B
A= ref $_[0]B= $_[0]
ABresult
1X1
011
000
Truth table66%2/3
A || B
A= ref $_[0]B= $_[0]
ABresult
1X1
011
000
Truth table66%2/3
A || B
A= ref $_[0]B= $_[0]
ABresult
1X1
011
000
Truth table66%2/3
A || B
A= ref $_[0]B= $_[0]
ABresult
1X1
011
000
Truth table66%2/3
A || B
A= ref $_[0]B= $_[0]
ABresult
1X1
011
000
Truth table66%2/3
A || B
A= ref $_[0]B= $_[0]
ABresult
1X1
011
000
Truth table66%2/3
A || B
A= ref $_[0]B= $_[0]
ABresult
1X1
011
000
Truth table66%2/3
A || B
A= ref $_[0]B= $_[0]
ABresult
1X1
011
000
Truth table66%2/3
A || B
A= ref $_[0]B= $_[0]
ABresult
1X1
011
000
16 9466 ▶ my $meta = Moose::Util::find_meta($pkg)
Condition66%26/39
Moose::Util::find_meta($pkg) || 'Moose::Meta::Class'->initialize($pkg)
l!l&&r!l&&!r
9449170
Moose::Util::find_meta($pkg) || 'Moose::Meta::Class'->initialize($pkg)
l!l&&r!l&&!r
20794430
Moose::Util::find_meta($pkg) || 'Moose::Meta::Class'->initialize($pkg)
l!l&&r!l&&!r
37558750
Moose::Util::find_meta($pkg) || 'Moose::Meta::Class'->initialize($pkg)
l!l&&r!l&&!r
19819340
Moose::Util::find_meta($pkg) || 'Moose::Meta::Class'->initialize($pkg)
l!l&&r!l&&!r
13769770
Moose::Util::find_meta($pkg) || 'Moose::Meta::Class'->initialize($pkg)
l!l&&r!l&&!r
24087560
Moose::Util::find_meta($pkg) || 'Moose::Meta::Class'->initialize($pkg)
l!l&&r!l&&!r
29392720
Moose::Util::find_meta($pkg) || 'Moose::Meta::Class'->initialize($pkg)
l!l&&r!l&&!r
29084600
Moose::Util::find_meta($pkg) || 'Moose::Meta::Class'->initialize($pkg)
l!l&&r!l&&!r
59196830
Moose::Util::find_meta($pkg) || 'Moose::Meta::Class'->initialize($pkg)
l!l&&r!l&&!r
16085330
Moose::Util::find_meta($pkg) || 'Moose::Meta::Class'->initialize($pkg)
l!l&&r!l&&!r
33443780
Moose::Util::find_meta($pkg) || 'Moose::Meta::Class'->initialize($pkg)
l!l&&r!l&&!r
36632640
Moose::Util::find_meta($pkg) || 'Moose::Meta::Class'->initialize($pkg)
l!l&&r!l&&!r
493690
MC/DC0%0/2
Moose::Util::find_meta($pkg) || 'Moose::Meta::Class'->initialize($pkg)
Moose::Util::find_meta($pkg) 'Moose::Meta::Class'->initialize($pkg)
MC/DC0%0/2
Moose::Util::find_meta($pkg) || 'Moose::Meta::Class'->initialize($pkg)
Moose::Util::find_meta($pkg) 'Moose::Meta::Class'->initialize($pkg)
MC/DC0%0/2
Moose::Util::find_meta($pkg) || 'Moose::Meta::Class'->initialize($pkg)
Moose::Util::find_meta($pkg) 'Moose::Meta::Class'->initialize($pkg)
MC/DC0%0/2
Moose::Util::find_meta($pkg) || 'Moose::Meta::Class'->initialize($pkg)
Moose::Util::find_meta($pkg) 'Moose::Meta::Class'->initialize($pkg)
MC/DC0%0/2
Moose::Util::find_meta($pkg) || 'Moose::Meta::Class'->initialize($pkg)
Moose::Util::find_meta($pkg) 'Moose::Meta::Class'->initialize($pkg)
MC/DC0%0/2
Moose::Util::find_meta($pkg) || 'Moose::Meta::Class'->initialize($pkg)
Moose::Util::find_meta($pkg) 'Moose::Meta::Class'->initialize($pkg)
MC/DC0%0/2
Moose::Util::find_meta($pkg) || 'Moose::Meta::Class'->initialize($pkg)
Moose::Util::find_meta($pkg) 'Moose::Meta::Class'->initialize($pkg)
MC/DC0%0/2
Moose::Util::find_meta($pkg) || 'Moose::Meta::Class'->initialize($pkg)
Moose::Util::find_meta($pkg) 'Moose::Meta::Class'->initialize($pkg)
MC/DC0%0/2
Moose::Util::find_meta($pkg) || 'Moose::Meta::Class'->initialize($pkg)
Moose::Util::find_meta($pkg) 'Moose::Meta::Class'->initialize($pkg)
MC/DC0%0/2
Moose::Util::find_meta($pkg) || 'Moose::Meta::Class'->initialize($pkg)
Moose::Util::find_meta($pkg) 'Moose::Meta::Class'->initialize($pkg)
MC/DC0%0/2
Moose::Util::find_meta($pkg) || 'Moose::Meta::Class'->initialize($pkg)
Moose::Util::find_meta($pkg) 'Moose::Meta::Class'->initialize($pkg)
MC/DC0%0/2
Moose::Util::find_meta($pkg) || 'Moose::Meta::Class'->initialize($pkg)
Moose::Util::find_meta($pkg) 'Moose::Meta::Class'->initialize($pkg)
MC/DC0%0/2
Moose::Util::find_meta($pkg) || 'Moose::Meta::Class'->initialize($pkg)
Moose::Util::find_meta($pkg) 'Moose::Meta::Class'->initialize($pkg)
Truth table66%2/3
A || B
A= Moose::Util::find_meta($pkg)B= 'Moose::Meta::Class'->initialize($pkg)
ABresult
1X1
011
000
Truth table66%2/3
A || B
A= Moose::Util::find_meta($pkg)B= 'Moose::Meta::Class'->initialize($pkg)
ABresult
1X1
011
000
Truth table66%2/3
A || B
A= Moose::Util::find_meta($pkg)B= 'Moose::Meta::Class'->initialize($pkg)
ABresult
1X1
011
000
Truth table66%2/3
A || B
A= Moose::Util::find_meta($pkg)B= 'Moose::Meta::Class'->initialize($pkg)
ABresult
1X1
011
000
Truth table66%2/3
A || B
A= Moose::Util::find_meta($pkg)B= 'Moose::Meta::Class'->initialize($pkg)
ABresult
1X1
011
000
Truth table66%2/3
A || B
A= Moose::Util::find_meta($pkg)B= 'Moose::Meta::Class'->initialize($pkg)
ABresult
1X1
011
000
Truth table66%2/3
A || B
A= Moose::Util::find_meta($pkg)B= 'Moose::Meta::Class'->initialize($pkg)
ABresult
1X1
011
000
Truth table66%2/3
A || B
A= Moose::Util::find_meta($pkg)B= 'Moose::Meta::Class'->initialize($pkg)
ABresult
1X1
011
000
Truth table66%2/3
A || B
A= Moose::Util::find_meta($pkg)B= 'Moose::Meta::Class'->initialize($pkg)
ABresult
1X1
011
000
Truth table66%2/3
A || B
A= Moose::Util::find_meta($pkg)B= 'Moose::Meta::Class'->initialize($pkg)
ABresult
1X1
011
000
Truth table66%2/3
A || B
A= Moose::Util::find_meta($pkg)B= 'Moose::Meta::Class'->initialize($pkg)
ABresult
1X1
011
000
Truth table66%2/3
A || B
A= Moose::Util::find_meta($pkg)B= 'Moose::Meta::Class'->initialize($pkg)
ABresult
1X1
011
000
Truth table66%2/3
A || B
A= Moose::Util::find_meta($pkg)B= 'Moose::Meta::Class'->initialize($pkg)
ABresult
1X1
011
000
17 || Moose::Meta::Class->initialize( $pkg );
18 9466 ▶ if (@_ > 1) {
Branch: 13 branches
BranchTrueFalseTotal
if (@_ > 1) 349 9117 9466
if (@_ > 1) 662 20175 20837
if (@_ > 1) 1322 36311 37633
if (@_ > 1) 574 19279 19853
if (@_ > 1) 646 13200 13846
if (@_ > 1) 961 23182 24143
if (@_ > 1) 1097 28367 29464
if (@_ > 1) 1012 28132 29144
if (@_ > 1) 1368 57911 59279
if (@_ > 1) 703 15415 16118
if (@_ > 1) 1406 32115 33521
if (@_ > 1) 1026 35670 36696
if (@_ > 1) 250 4695 4945
19 349 $meta->namespace->{$attribute} = \$_[1];
20 349 return $_[1];
21 }
22  
23 # tighter version of
24 # if ( $meta->has_package_symbol($slot) ) {
25 # return ${ $meta->get_package_symbol($slot) };
26 # }
27 171 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
28 9117 my $v = *{"${pkg}::${attribute}"}{SCALAR};
29 9117 ▶ if (defined ${$v}) {
Branch: 13 branches
BranchTrueFalseTotal
if (defined ${$v;}) { } 6752 2365 9117
if (defined ${$v;}) { } 14574 5601 20175
if (defined ${$v;}) { } 26039 10272 36311
if (defined ${$v;}) { } 14499 4780 19279
if (defined ${$v;}) { } 9471 3729 13200
if (defined ${$v;}) { } 15645 7537 23182
if (defined ${$v;}) { } 18879 9488 28367
if (defined ${$v;}) { } 20482 7650 28132
if (defined ${$v;}) { } 45807 12104 57911
if (defined ${$v;}) { } 10860 4555 15415
if (defined ${$v;}) { } 22171 9944 32115
if (defined ${$v;}) { } 26811 8859 35670
if (defined ${$v;}) { } 3437 1258 4695
30 6752 return ${$v};
31 } else {
32 2365 foreach my $super ( $meta->linearized_isa ) {
33 # tighter version of same after
34 # my $super_meta = Moose::Meta::Class->initialize($super);
35 7264 ▶ my $v = ${"${super}::"}{$attribute} ? *{"${super}::${attribute}"}{SCALAR} : undef;
Branch: 13 branches
BranchTrueFalseTotal
do { "${super}::" }->{$attribute} ? : 5422 1842 7264
do { "${super}::" }->{$attribute} ? : 12932 2875 15807
do { "${super}::" }->{$attribute} ? : 23658 5810 29468
do { "${super}::" }->{$attribute} ? : 10944 2499 13443
do { "${super}::" }->{$attribute} ? : 8498 2218 10716
do { "${super}::" }->{$attribute} ? : 17496 3415 20911
do { "${super}::" }->{$attribute} ? : 22090 4295 26385
do { "${super}::" }->{$attribute} ? : 17722 3802 21524
do { "${super}::" }->{$attribute} ? : 27668 14390 42058
do { "${super}::" }->{$attribute} ? : 10494 2618 13112
do { "${super}::" }->{$attribute} ? : 23009 5449 28458
do { "${super}::" }->{$attribute} ? : 20486 6724 27210
do { "${super}::" }->{$attribute} ? : 2862 812 3674
36 7264 ▶ if (defined ${$v}) {
Branch: 13 branches
BranchTrueFalseTotal
if (defined ${$v;}) 2146 5118 7264
if (defined ${$v;}) 5178 10629 15807
if (defined ${$v;}) 9419 20049 29468
if (defined ${$v;}) 4412 9031 13443
if (defined ${$v;}) 3280 7436 10716
if (defined ${$v;}) 6913 13998 20911
if (defined ${$v;}) 8778 17607 26385
if (defined ${$v;}) 7002 14522 21524
if (defined ${$v;}) 11232 30826 42058
if (defined ${$v;}) 4108 9004 13112
if (defined ${$v;}) 9053 19405 28458
if (defined ${$v;}) 8197 19013 27210
if (defined ${$v;}) 1101 2573 3674
37 2146 return ${$v};
38 }
39 }
40 }
41 219 return;
42 5187 };
43  
44 5187 ▶ confess("Failed to create accessor: $@ ")
Branch: 1 branch
BranchTrueFalseTotal
unless ref $accessor eq "CODE" 0 5187 5187
45 unless ref $accessor eq 'CODE';
46  
47 5187 my $meta = $class->Class::MOP::Object::meta();
48 5187 ▶ confess "${class}'s metaclass is not a Class::MOP::Class"
Branch: 1 branch
BranchTrueFalseTotal
unless $meta->isa("Class::MOP::Class") 0 5187 5187
49 unless $meta->isa('Class::MOP::Class');
50  
51 5187 my $was_immutable = $meta->is_immutable;
52 5187 my %immutable_options = $meta->immutable_options;
53  
54 5187 ▶ $meta->make_mutable if $was_immutable;
Branch: 1 branch
BranchTrueFalseTotal
if $was_immutable 0 5187 5187
55  
56 5187 my $alias = "_${attribute}_accessor";
57 5187 $meta->add_method($alias, $accessor);
58 5187 $meta->add_method($attribute, $accessor);
59  
60 5187 ▶ $meta->make_immutable(%immutable_options) if $was_immutable;
Branch: 1 branch
BranchTrueFalseTotal
if $was_immutable 0 5187 5187
61  
62 5187 ▶ $class->$attribute($_[2]) if(@_ > 2);
Branch: 1 branch
BranchTrueFalseTotal
if @_ > 2 1 5186 5187
63 5187 return $accessor;
64 }
65  
66 7 1;
67  
68 __END__
« lib/Catalyst/Test.pm ↑ Summary lib/Catalyst/Stats.pm »