| 1 | package Catalyst::Seal::Execute; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 19 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 19 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 19 | ▶ | use Carp (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 19 | ▶ | use Scalar::Util (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 19 | ▶ | use Catalyst::Seal (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 19 | ▶ | use Catalyst::Seal::Guard (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 19 | our $VERSION = '0.04'; | |||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 84 | ▶ | sub _plain_slot { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_plain_slot: called CC=16 SCAR=31.3
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | 84 | my ($class, $name, %want) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | 84 | ▶ | my $meta = Class::MOP::class_of($class) or return 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 84 | ▶ | return 0 unless $meta->isa('Class::MOP::Class'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 84 | ▶ | return 0 unless $meta->is_immutable; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | 84 | my $im = $meta->instance_metaclass; | |||||||||||||||||||||||||||||||||||||||||
| 22 | 84 | ▶ | return 0 unless $im->isa('Class::MOP::Instance'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | 84 | ▶ | my $attr = $meta->find_attribute_by_name($name) or return 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | 84 | my @slots = $attr->slots; | |||||||||||||||||||||||||||||||||||||||||
| 27 | 84 | ▶ | return 0 unless @slots == 1 && $slots[0] eq $name; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@slots == 1 and $slots[0] eq $name
MC/DC0%0/2
@slots == 1 and $slots[0] eq $name
@slots == 1
$slots[0] eq $name
Truth table33%1/3
A and B
A= @slots == 1B= $slots[0] eq $name
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | 84 | ▶ | return 0 if $attr->is_lazy; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | 84 | ▶ | return 0 if $attr->has_type_constraint; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | 84 | ▶ | return 0 if $attr->has_trigger; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 84 | ▶ | return 0 if $attr->should_coerce; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | 84 | ▶ | return 0 if $attr->is_weak_ref; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | 84 | ▶ | return 0 if $attr->has_initializer; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | 84 | ▶ | if ($want{write}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 12 | my $w = $attr->get_write_method; | |||||||||||||||||||||||||||||||||||||||||
| 38 | 12 | ▶ | return 0 unless defined $w; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | 84 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | 3528 | ▶ | sub _execute { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_execute: called CC=17 SCAR=36.4
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | 3528 | my ( $c, $class, $code ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 46 | 3528 | ▶ | $class = $c->component($class) || $class; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$c->component($class) || $class
MC/DC0%0/2
$c->component($class) || $class
$c->component($class)
$class
Truth table33%1/3
A || B
A= $c->component($class)B= $class
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | 3528 | my $stack = $c->{stack}; | |||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | 3528 | ▶ | if ( @$stack >= $Catalyst::RECURSION ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | my $action = $code->reverse(); | |||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | ▶ | $action = "/$action" unless $action =~ /->/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | my $error = qq/Deep recursion detected calling "${action}"/; | |||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | $c->log->error($error); | |||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | $c->error($error); | |||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | $c->{state} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | return $c->{state}; | |||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | 3528 | push @$stack, $code; | |||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | 19 | ▶ | no warnings 'recursion'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | 3528 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 64 | 3528 | ▶ | my $ret = $code->execute( $class, $c, @{ $c->{request}{arguments} } ) || 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$code->execute($class, $c, @{$$c{'request'}{'arguments'};}) || 0
MC/DC100%1/1
$code->execute($class, $c, @{$$c{'request'}{'arguments'};}) || 0
$code->execute($class, $c, @{$$c{'request'}{'arguments'};})
Truth table100%2/2
A
A= $code->execute($class, $c, @{$$c{'request'}{'arguments'};})
| |||||||||||||||||||||||||||||||||||||||||||
| 65 | 3523 | $c->{state} = $ret; | |||||||||||||||||||||||||||||||||||||||||
| 66 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | 3528 | my $last = pop @$stack; | |||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | 3528 | ▶ | if ( my $error = $@ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 71 | 4 | ▶ | if ( $c->_handle_http_exception($error) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | foreach my $err (@{ $c->error }) { | |||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | $c->log->error($err); | |||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | $c->clear_errors; | |||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | $c->log->_flush if $c->log->can('_flush'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | $error->can('rethrow') ? $error->rethrow : Carp::croak $error; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||
| 80 | 4 | ▶ | if ( Scalar::Util::blessed($error) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
builtin::blessed($error) and $error->isa("Catalyst::Exception::Detach")
MC/DC50%1/2
builtin::blessed($error) and $error->isa("Catalyst::Exception::Detach")
builtin::blessed($error)
$error->isa("Catalyst::Exception::Detach")
Truth table66%2/3
A and B
A= builtin::blessed($error)B= $error->isa("Catalyst::Exception::Detach")
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | and $error->isa('Catalyst::Exception::Detach') ) { | ||||||||||||||||||||||||||||||||||||||||||
| 82 | 2 | ▶ | $error->rethrow if @$stack > 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||
| 84 | ▶ | elsif ( Scalar::Util::blessed($error) | |||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
builtin::blessed($error) and $error->isa("Catalyst::Exception::Go")
MC/DC0%0/2
builtin::blessed($error) and $error->isa("Catalyst::Exception::Go")
builtin::blessed($error)
$error->isa("Catalyst::Exception::Go")
Truth table33%1/3
A and B
A= builtin::blessed($error)B= $error->isa("Catalyst::Exception::Go")
| |||||||||||||||||||||||||||||||||||||||||||
| 85 | and $error->isa('Catalyst::Exception::Go') ) { | ||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | $error->rethrow if @$stack > 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||
| 88 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 89 | 2 | ▶ | unless ( ref $error ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | 19 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 91 | 2 | chomp $error; | |||||||||||||||||||||||||||||||||||||||||
| 92 | 2 | my $class = $last->class; | |||||||||||||||||||||||||||||||||||||||||
| 93 | 2 | my $name = $last->name; | |||||||||||||||||||||||||||||||||||||||||
| 94 | 2 | $error = qq/Caught exception in $class->$name "$error"/; | |||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||
| 96 | 2 | $c->error($error); | |||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||
| 99 | 3527 | return $c->{state}; | |||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | ▶ | sub _execute_stats { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_execute_stats: not called CC=18 SCAR=56.1
| |||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | my ( $c, $class, $code ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | ▶ | $class = $c->component($class) || $class; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$c->component($class) || $class
MC/DC0%0/2
$c->component($class) || $class
$c->component($class)
$class
Truth table0%0/3
A || B
A= $c->component($class)B= $class
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | my $stack = $c->{stack}; | |||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | if ( @$stack >= $Catalyst::RECURSION ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | my $action = $code->reverse(); | |||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | ▶ | $action = "/$action" unless $action =~ /->/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | my $error = qq/Deep recursion detected calling "${action}"/; | |||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | $c->log->error($error); | |||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | $c->error($error); | |||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | $c->{state} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | return $c->{state}; | |||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | my $stats_info = $c->_stats_start_execute( $code ); | |||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | push @$stack, $code; | |||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | 19 | ▶ | no warnings 'recursion'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | my $ret = $code->execute( $class, $c, @{ $c->{request}{arguments} } ) || 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$code->execute($class, $c, @{$$c{'request'}{'arguments'};}) || 0
MC/DC0%0/1
$code->execute($class, $c, @{$$c{'request'}{'arguments'};}) || 0
$code->execute($class, $c, @{$$c{'request'}{'arguments'};})
Truth table0%0/2
A
A= $code->execute($class, $c, @{$$c{'request'}{'arguments'};})
| |||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | $c->{state} = $ret; | |||||||||||||||||||||||||||||||||||||||||
| 126 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | ▶ | $c->_stats_finish_execute( $stats_info ) if $stats_info; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | my $last = pop @$stack; | |||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | if ( my $error = $@ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | ▶ | if ( $c->_handle_http_exception($error) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | foreach my $err (@{ $c->error }) { | |||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | $c->log->error($err); | |||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | $c->clear_errors; | |||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | ▶ | $c->log->_flush if $c->log->can('_flush'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | $error->can('rethrow') ? $error->rethrow : Carp::croak $error; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | if ( Scalar::Util::blessed($error) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
builtin::blessed($error) and $error->isa("Catalyst::Exception::Detach")
MC/DC0%0/2
builtin::blessed($error) and $error->isa("Catalyst::Exception::Detach")
builtin::blessed($error)
$error->isa("Catalyst::Exception::Detach")
Truth table0%0/3
A and B
A= builtin::blessed($error)B= $error->isa("Catalyst::Exception::Detach")
| |||||||||||||||||||||||||||||||||||||||||||
| 143 | and $error->isa('Catalyst::Exception::Detach') ) { | ||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | ▶ | $error->rethrow if @$stack > 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||
| 146 | ▶ | elsif ( Scalar::Util::blessed($error) | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
builtin::blessed($error) and $error->isa("Catalyst::Exception::Go")
MC/DC0%0/2
builtin::blessed($error) and $error->isa("Catalyst::Exception::Go")
builtin::blessed($error)
$error->isa("Catalyst::Exception::Go")
Truth table0%0/3
A and B
A= builtin::blessed($error)B= $error->isa("Catalyst::Exception::Go")
| |||||||||||||||||||||||||||||||||||||||||||
| 147 | and $error->isa('Catalyst::Exception::Go') ) { | ||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | $error->rethrow if @$stack > 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||
| 150 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | unless ( ref $error ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | 19 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | chomp $error; | |||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | my $class = $last->class; | |||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | my $name = $last->name; | |||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | $error = qq/Caught exception in $class->$name "$error"/; | |||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | $c->error($error); | |||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | return $c->{state}; | |||||||||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||
| 164 | 12 | ▶ | sub _seal_execute { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_seal_execute: called CC=8 SCAR=26.7
| |||||||||||||||||||||||||||||||||||||||||||
| 165 | 12 | my ($app) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | 12 | ▶ | my $ctx = $app->context_class || $app; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$app->context_class || $app
MC/DC0%0/2
$app->context_class || $app
$app->context_class
$app
Truth table33%1/3
A || B
A= $app->context_classB= $app
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | 12 | ▶ | my $req = eval { $app->composed_request_class } || $app->request_class; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
eval {
do {
$app->composed_request_class
}
} || $app->request_class
MC/DC0%0/2
eval {
do {
$app->composed_request_class
}
} || $app->request_class
eval {
do {
$app->composed_request_class
}
}
$app->request_class
Truth table33%1/3
A || B
A= eval {
do {
$app->composed_request_class
}
}B= $app->request_class
| |||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||
| 170 | 12 | ▶ | unless (_plain_slot($ctx, 'stack') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
_plain_slot($ctx, "stack") and _plain_slot($ctx, "state", "write", 1) and _plain_slot($req, "arguments")
_plain_slot($ctx, "stack") and _plain_slot($ctx, "state", "write", 1)
MC/DC0%0/3
_plain_slot($ctx, "stack") and _plain_slot($ctx, "state", "write", 1) and _plain_slot($req, "arguments")
_plain_slot($ctx, "stack")
_plain_slot($ctx, "state", "write", 1)
_plain_slot($req, "arguments")
Truth table25%1/4
A and B and C
A= _plain_slot($ctx, "stack")B= _plain_slot($ctx, "state", "write", 1)C= _plain_slot($req, "arguments")
| |||||||||||||||||||||||||||||||||||||||||||
| 171 | && _plain_slot($ctx, 'state', write => 1) | ||||||||||||||||||||||||||||||||||||||||||
| 172 | && _plain_slot($req, 'arguments')) { | ||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | Catalyst::Seal::note( | |||||||||||||||||||||||||||||||||||||||||
| 174 | 'execute not hoisted: stack, state or arguments is not a plain slot'); | ||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||
| 178 | 12 | ▶ | my $stats = eval { $app->use_stats } ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||
| 180 | 12 | ▶ | return Catalyst::Seal::Guard::replace( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 181 | 'Catalyst::execute' => $stats ? \&_execute_stats : \&_execute); | ||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||
| 184 | 12 | ▶ | sub _seal_use_stats { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_seal_use_stats: called CC=5 SCAR=17.8
| |||||||||||||||||||||||||||||||||||||||||||
| 185 | 12 | my ($app) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||
| 187 | 12 | ▶ | my $ctx = $app->context_class || $app; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$app->context_class || $app
MC/DC0%0/2
$app->context_class || $app
$app->context_class
$app
Truth table33%1/3
A || B
A= $app->context_classB= $app
| |||||||||||||||||||||||||||||||||||||||||||
| 188 | 12 | ▶ | my $orig = $ctx->can('use_stats') or return 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||
| 190 | 12 | my $value = eval { $app->use_stats }; | |||||||||||||||||||||||||||||||||||||||||
| 191 | 12 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | Catalyst::Seal::note("could not resolve use_stats, not sealed: $@"); | |||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | 12 | my $ok = eval { | |||||||||||||||||||||||||||||||||||||||||
| 197 | 19 | ▶ | no warnings 'redefine'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 198 | 12 | Catalyst::Seal::_install_const($ctx, 'use_stats', $value, $orig, undef); | |||||||||||||||||||||||||||||||||||||||||
| 199 | 12 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 200 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 201 | 12 | ▶ | unless ($ok) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | Catalyst::Seal::note("could not seal use_stats: $@"); | |||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||
| 205 | 12 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||
| 208 | 12 | ▶ | sub _seal_depth { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_seal_depth: called CC=5 SCAR=17.4
| |||||||||||||||||||||||||||||||||||||||||||
| 209 | 12 | my ($app) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||
| 211 | 12 | ▶ | my $ctx = $app->context_class || $app; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$app->context_class || $app
MC/DC0%0/2
$app->context_class || $app
$app->context_class
$app
Truth table33%1/3
A || B
A= $app->context_classB= $app
| |||||||||||||||||||||||||||||||||||||||||||
| 212 | 12 | ▶ | return 0 unless _plain_slot($ctx, 'stack'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||
| 214 | 12 | ▶ | my $orig = $ctx->can('depth') or return 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||
| 216 | 12 | my $ok = eval { | |||||||||||||||||||||||||||||||||||||||||
| 217 | 19 | ▶ | no warnings 'redefine'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 218 | 12 | Catalyst::Seal::_install_count($ctx, 'depth', 'stack', $orig); | |||||||||||||||||||||||||||||||||||||||||
| 219 | 12 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 220 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 221 | 12 | ▶ | unless ($ok) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | Catalyst::Seal::note("could not seal depth: $@"); | |||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||
| 225 | 12 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||
| 228 | 19 | my @ACTION_SLOTS = qw(code instance class); | |||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||
| 230 | 12 | ▶ | sub _seal_actions { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_seal_actions: called CC=12 SCAR=28.3
| |||||||||||||||||||||||||||||||||||||||||||
| 231 | 12 | my ($app) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||
| 233 | 12 | my $class = 'Catalyst::Action'; | |||||||||||||||||||||||||||||||||||||||||
| 234 | 12 | ▶ | my $meta = Class::MOP::class_of($class) or return 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 235 | 12 | ▶ | return 0 unless $meta->isa('Class::MOP::Class'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||
| 237 | 12 | for my $slot (@ACTION_SLOTS) { | |||||||||||||||||||||||||||||||||||||||||
| 238 | 36 | ▶ | next if _plain_slot($class, $slot); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | Catalyst::Seal::note( | |||||||||||||||||||||||||||||||||||||||||
| 240 | "Catalyst::Action::$slot is not a plain slot, the action pair was not sealed"); | ||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | 12 | my $sealed = 0; | |||||||||||||||||||||||||||||||||||||||||
| 245 | 12 | for my $name (qw(execute dispatch)) { | |||||||||||||||||||||||||||||||||||||||||
| 246 | 24 | ▶ | my $method = $meta->get_method($name) or next; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 247 | 24 | ▶ | if ($method->isa('Class::MOP::Method::Wrapped')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | Catalyst::Seal::note("Catalyst::Action::$name is wrapped, not sealed"); | |||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||
| 252 | 24 | ▶ | my $body = $method->body or next; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 253 | 24 | ▶ | my $installed = $class->can($name) or next; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 254 | 24 | ▶ | next unless $installed == $body; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||
| 256 | 24 | my $ok = eval { | |||||||||||||||||||||||||||||||||||||||||
| 257 | 19 | ▶ | no warnings 'redefine'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 258 | 24 | Catalyst::Seal::_install_action( | |||||||||||||||||||||||||||||||||||||||||
| 259 | $class, $name, $name, 'code', 'instance', 'class', $body); | ||||||||||||||||||||||||||||||||||||||||||
| 260 | 24 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 261 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 262 | 24 | ▶ | unless ($ok) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | Catalyst::Seal::note("could not seal Catalyst::Action::$name: $@"); | |||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||||||||||||||||
| 266 | 24 | $sealed++; | |||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||
| 269 | 12 | return $sealed; | |||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||
| 272 | 19 | my $PATCHED = 0; | |||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||
| 274 | 12 | ▶ | Catalyst::Seal::register_step('execute' => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||||||||||||||||
| 275 | 12 | my ($app) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||
| 277 | 12 | require Class::MOP; | |||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||
| 279 | 12 | my $stats = _seal_use_stats($app); | |||||||||||||||||||||||||||||||||||||||||
| 280 | 12 | my $depth = _seal_depth($app); | |||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||
| 282 | 12 | my ($execute, $actions) = (0, 0); | |||||||||||||||||||||||||||||||||||||||||
| 283 | 12 | ▶ | unless ($PATCHED++) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 284 | 12 | $execute = _seal_execute($app); | |||||||||||||||||||||||||||||||||||||||||
| 285 | 12 | $actions = _seal_actions($app); | |||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||
| 288 | Catalyst::Seal::note( | ||||||||||||||||||||||||||||||||||||||||||
| 289 | 12 | ▶ | "execute: hoisted=$execute actions=$actions use_stats=$stats depth=$depth") | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 290 | if $Catalyst::Seal::DEBUG; | ||||||||||||||||||||||||||||||||||||||||||
| 291 | 12 | return; | |||||||||||||||||||||||||||||||||||||||||
| 292 | 19 | }); | |||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||
| 294 | 19 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||
| 296 | __END__ | ||||||||||||||||||||||||||||||||||||||||||