| 1 | package Catalyst::Seal::Finalize; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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 Scalar::Util (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 19 | ▶ | use Catalyst::Seal (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 19 | ▶ | use Catalyst::Seal::Guard (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 19 | our $VERSION = '0.04'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 19 | my %DECISION; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 19 | our $MAX_KEYS = 512; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 19 | my $CAPPED = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 7 | ▶ | sub _clear { %DECISION = (); $CAPPED = 0; return } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_clear: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 1 | ▶ | sub capped { $CAPPED } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
capped: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 2 | ▶ | sub memo_size { scalar keys %DECISION } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
memo_size: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 125 | ▶ | sub _decide { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_decide: called CC=14 SCAR=26.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 125 | my ($res, $cenc, $ectype, $mime) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 125 | my $ct = $res->content_type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 125 | my $charset = $res->content_type_charset; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 125 | my $has_manual_charset = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 125 | ▶ | if (defined $charset && length $charset) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $charset and length $charset
MC/DC50%1/2
defined $charset and length $charset
defined $charset
length $charset
Truth table66%2/3
A and B
A= defined $charsetB= length $charset
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 4 | ▶ | $has_manual_charset = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $mime and uc $charset ne uc $mime
MC/DC50%1/2
defined $mime and uc $charset ne uc $mime
defined $mime
uc $charset ne uc $mime
Truth table66%2/3
A and B
A= defined $mimeB= uc $charset ne uc $mime
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | (defined $mime && uc($charset) ne uc($mime)) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 125 | my $encodable = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 125 | ▶ | if (defined $mime) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 123 | ▶ | my $type_ok = (defined $ct && $ct =~ m/$ectype/) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $ct and $ct =~ /$ectype/
MC/DC50%1/2
defined $ct and $ct =~ /$ectype/
defined $ct
$ct =~ /$ectype/
Truth table66%2/3
A and B
A= defined $ctB= $ct =~ /$ectype/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 123 | ▶ | my $enc_ok = (!defined $cenc || !length $cenc || $cenc eq 'identity') ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
not defined $cenc && length $cenc or $cenc eq "identity"
defined $cenc && length $cenc
MC/DC66%2/3
not defined $cenc && length $cenc or $cenc eq "identity"
defined $cenc
length $cenc
$cenc eq "identity"
Truth table75%3/4
not(A && B) or C
A= defined $cencB= length $cencC= $cenc eq "identity"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 123 | ▶ | $encodable = ($type_ok && !$has_manual_charset && $enc_ok) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$type_ok and not $has_manual_charset and $enc_ok
$type_ok and not $has_manual_charset
MC/DC100%3/3
$type_ok and not $has_manual_charset and $enc_ok
$type_ok
not $has_manual_charset
$enc_ok
Truth table100%4/4
A and not(B) and C
A= $type_okB= not $has_manual_charsetC= $enc_ok
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 125 | return { encodable => $encodable, charset => $charset, ct => $ct }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 367 | ▶ | sub _finalize_encoding { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_finalize_encoding: called CC=22 SCAR=32.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 367 | my $c = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 367 | ▶ | my $res = $c->res || return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$c->res || (return)
MC/DC0%0/1
$c->res || (return)
$c->res
Truth table50%1/2
A
A= $c->res
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 367 | my $ctx = $res->_context; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 367 | ▶ | return _stock_finalize_encoding($c) if !$ctx || $ctx != $c; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $ctx or $ctx != $c
MC/DC0%0/2
not $ctx or $ctx != $c
not $ctx
$ctx != $c
Truth table33%1/3
not(A) or B
A= not $ctxB= $ctx != $c
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 367 | my $enc = $c->encoding; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 367 | ▶ | my $mime = $enc ? $enc->mime_name : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 367 | my $cenc = $res->content_encoding; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 367 | my $ectype = $res->encodable_content_type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 367 | my $raw = $res->headers->header('Content-Type'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 367 | ▶ | my $key = join "\0", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | (defined $raw ? $raw : ''), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | (defined $cenc ? $cenc : ''), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | (defined $ectype ? "$ectype" : ''), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | (defined $mime ? $mime : ''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 367 | my $d = $DECISION{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 367 | ▶ | unless ($d) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 125 | $d = _decide($res, $cenc, $ectype, $mime); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 125 | ▶ | if (keys %DECISION < $MAX_KEYS) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 28 | $DECISION{$key} = $d; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | elsif (!$CAPPED++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 1 | Catalyst::Seal::note( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | "encoding decision memo reached $MAX_KEYS keys, no longer caching"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 367 | ▶ | if ($d->{charset} && defined $mime && uc($mime) ne uc($d->{charset})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$d->{"charset"} and defined $mime and uc $mime ne uc $d->{"charset"}
$d->{"charset"} and defined $mime
MC/DC66%2/3
$d->{"charset"} and defined $mime and uc $mime ne uc $d->{"charset"}
$d->{"charset"}
defined $mime
uc $mime ne uc $d->{"charset"}
Truth table75%3/4
A and B and C
A= $d->{"charset"}B= defined $mimeC= uc $mime ne uc $d->{"charset"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 3 | my $lc = lc $d->{charset}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 3 | $c->log->debug("Catalyst encoding config is set to encode in '" . | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | $mime . "', content type is '$lc', not encoding "); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 367 | ▶ | if ($d->{encodable} && defined($res->body) && ref(\$res->body) eq 'SCALAR') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$d->{"encodable"} and defined $res->body and ref \$res->body eq "SCALAR"
$d->{"encodable"} and defined $res->body
MC/DC100%3/3
$d->{"encodable"} and defined $res->body and ref \$res->body eq "SCALAR"
$d->{"encodable"}
defined $res->body
ref \$res->body eq "SCALAR"
Truth table100%4/4
A and B and C
A= $d->{"encodable"}B= defined $res->bodyC= ref \$res->body eq "SCALAR"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 157 | $res->body( $enc->encode( $res->body, $c->_encode_check ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | $res->content_type($d->{ct} . "; charset=" . $mime) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | unless ($d->{charset} || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 157 | ▶ | ($ctx && $res->finalized_headers && !$res->_has_response_cb)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$d->{"charset"} or $ctx and $res->finalized_headers and not $res->_has_response_cb
$ctx and $res->finalized_headers and not $res->_has_response_cb
$ctx and $res->finalized_headers
MC/DC0%0/4
$d->{"charset"} or $ctx and $res->finalized_headers and not $res->_has_response_cb
$d->{"charset"}
$ctx
$res->finalized_headers
not $res->_has_response_cb
Truth table20%1/5
A or B and C and not(D)
A= $d->{"charset"}B= $ctxC= $res->finalized_headersD= not $res->_has_response_cb
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 367 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | ▶ | sub _stock_finalize_encoding { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_stock_finalize_encoding: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | my ($c) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | ▶ | my $orig = $Catalyst::Seal::Guard::ORIGINAL{'Catalyst::finalize_encoding'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | return $orig->($c); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 388 | ▶ | sub _response_destroy { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_response_destroy: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 388 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 388 | ▶ | return $self->Moose::Object::DESTROY(@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | if Scalar::Util::blessed($self) ne 'Catalyst::Response'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 386 | local $?; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 386 | my $igd = Devel::GlobalDestruction::in_global_destruction(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 386 | my $ok = eval { $self->Catalyst::Response::DEMOLISH($igd); 1 }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 386 | ▶ | die $@ unless $ok; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 386 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 12 | ▶ | sub _destroy_is_stock { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_destroy_is_stock: called CC=7 SCAR=20.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 12 | ▶ | my $cv = Catalyst::Response->can('DESTROY') or return 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 12 | ▶ | return 0 unless Catalyst::Response->can('DEMOLISH'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 12 | my $text = eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 12 | require B::Deparse; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 12 | B::Deparse->new->coderef2text($cv); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 12 | ▶ | return 0 unless defined $text; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 12 | for my $want (qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | Moose::Object::DESTROY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | in_global_destruction | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | Try::Tiny::try | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | DEMOLISH | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | )) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 48 | ▶ | return 0 unless index($text, $want) >= 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 12 | ▶ | return 0 if index($text, 'DEMOLISHALL') >= 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 12 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 19 | my $PATCHED = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 12 | ▶ | Catalyst::Seal::register_step('finalize' => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 12 | my ($app) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 12 | ▶ | return if $PATCHED++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 12 | my $enc = Catalyst::Seal::Guard::replace( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 'Catalyst::finalize_encoding' => \&_finalize_encoding); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 12 | my $destroy = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 12 | require Devel::GlobalDestruction; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 12 | require Scalar::Util; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 12 | ▶ | if (_destroy_is_stock()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 19 | ▶ | no warnings 'redefine'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 12 | ▶ | $Catalyst::Seal::Guard::ORIGINAL{'Catalyst::Response::DESTROY'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$Catalyst::Seal::Guard::ORIGINAL{"Catalyst::Response::DESTROY"} ||= "Catalyst::Response"->can("DESTROY")
MC/DC0%0/2
$Catalyst::Seal::Guard::ORIGINAL{"Catalyst::Response::DESTROY"} ||= "Catalyst::Response"->can("DESTROY")
$Catalyst::Seal::Guard::ORIGINAL{"Catalyst::Response::DESTROY"}
"Catalyst::Response"->can("DESTROY")
Truth table33%1/3
A ||= B
A= $Catalyst::Seal::Guard::ORIGINAL{"Catalyst::Response::DESTROY"}B= "Catalyst::Response"->can("DESTROY")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | ||= Catalyst::Response->can('DESTROY'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 12 | *Catalyst::Response::DESTROY = \&_response_destroy; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 12 | $destroy = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | Catalyst::Seal::note( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 'Catalyst::Response::DESTROY is not the shape we replace, left alone'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 12 | ▶ | Catalyst::Seal::note("finalize: encoding=$enc destroy=$destroy") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | if $Catalyst::Seal::DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 12 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 19 | }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 19 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||