| 1 | package Catalyst::Plugin::StackTrace; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 6 | ▶ | use 5.008001; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 6 | ▶ | use Moose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 6 | with 'MooseX::Emulate::Class::Accessor::Fast'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 6 | ▶ | use Devel::StackTrace; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 6 | ▶ | use HTML::Entities; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 6 | ▶ | use Scalar::Util qw/blessed/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 6 | ▶ | use MRO::Compat; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 6 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 6 | our $VERSION = '0.12'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 6 | __PACKAGE__->mk_accessors('_stacktrace'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 62 | ▶ | sub execute { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
execute: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 62 | my $c = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 62 | my $conf = $c->config->{stacktrace}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | return $c->next::method(@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | unless defined $conf->{enable} && $conf->{enable} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 62 | ▶ | || !defined $conf->{enable} && $c->debug; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%6/9
defined $conf->{"enable"} and $conf->{"enable"} or not defined $conf->{"enable"} and $c->debug
defined $conf->{"enable"} and $conf->{"enable"}
not defined $conf->{"enable"} and $c->debug
MC/DC0%0/4
defined $conf->{"enable"} and $conf->{"enable"} or not defined $conf->{"enable"} and $c->debug
defined $conf->{"enable"}
$conf->{"enable"}
not defined $conf->{"enable"}
$c->debug
Truth table28%2/7
A and B or not(C) and D
A= defined $conf->{"enable"}B= $conf->{"enable"}C= not defined $conf->{"enable"}D= $c->debug
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 14 | ▶ | local $SIG{__DIE__} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=9 SCAR=22.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 14 | my $error = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | # ignore if the error is a Tree::Simple object | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | # because FindByUID uses an internal die several times per request | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 14 | ▶ | return if ( blessed($error) && $error->isa('Tree::Simple') ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
builtin::blessed($error) and $error->isa("Tree::Simple")
MC/DC100%2/2
builtin::blessed($error) and $error->isa("Tree::Simple")
builtin::blessed($error)
$error->isa("Tree::Simple")
Truth table100%3/3
A and B
A= builtin::blessed($error)B= $error->isa("Tree::Simple")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 7 | my $ignore_package = [ 'Catalyst::Plugin::StackTrace' ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 7 | my $ignore_class = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 7 | ▶ | if ( $c->config->{stacktrace}->{verbose} < 2 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 6 | $ignore_package = [ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | qw/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | Catalyst | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | Catalyst::Action | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | Catalyst::Base | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | Catalyst::Dispatcher | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | Catalyst::Plugin::StackTrace | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | Catalyst::Plugin::Static::Simple | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | NEXT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | Class::C3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | main | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | / | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 6 | $ignore_class = [ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | qw/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | Catalyst::Engine | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | / | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | # Devel::StackTrace dies sometimes, and dying in $SIG{__DIE__} does bad | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | # things | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 7 | my $trace; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 7 | local $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 7 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 7 | $trace = Devel::StackTrace->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | ignore_package => $ignore_package, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | ignore_class => $ignore_class, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 7 | ▶ | die $error unless defined $trace; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | my @frames = $c->config->{stacktrace}->{reverse} ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 6 | ▶ | reverse $trace->frames : $trace->frames; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 6 | my $keep_frames = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 6 | for my $frame ( @frames ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | # only display frames from the user's app unless verbose | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 181 | ▶ | if ( !$c->config->{stacktrace}->{verbose} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 50 | my $app = "$c"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 50 | $app =~ s/=.*//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 50 | ▶ | next unless $frame->package =~ /^$app/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 135 | push @{$keep_frames}, { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | pkg => $frame->package, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | file => $frame->filename, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | line => $frame->line, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 6 | $c->_stacktrace( $keep_frames ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 6 | die $error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 55 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 55 | return $c->next::method(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 8 | ▶ | sub finalize_error { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
finalize_error: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 8 | my $c = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 8 | $c->next::method(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 8 | ▶ | if ( $c->debug ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 8 | ▶ | return unless ref $c->_stacktrace eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | # insert the stack trace into the error screen above the "infos" div | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 6 | my $html = qq{ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | <style type="text/css"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | div.trace { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | background-color: #eee; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | border: 1px solid #575; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | div#stacktrace table { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | width: 100%; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | div#stacktrace th, td { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | padding-right: 1.5em; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | text-align: left; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | div#stacktrace .line { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | color: #000; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | font-weight: strong; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | </style> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | <div class="trace error"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | <h2><a href="#" onclick="toggleDump('stacktrace'); return false">Stack Trace</a></h2> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | <div id="stacktrace"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | <table> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | <tr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | <th>Package</th> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | <th>Line </th> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | <th>File </th> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | </tr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 6 | for my $frame ( @{$c->_stacktrace} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | # clean up the common filename of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | # .../MyApp/script/../lib/... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 135 | ▶ | if ( $frame->{file} =~ /../ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 135 | $frame->{file} =~ s{script/../}{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 135 | my $pkg = encode_entities $frame->{pkg}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 135 | my $line = encode_entities $frame->{line}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 135 | my $file = encode_entities $frame->{file}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | my $code_preview = _print_context( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | $frame->{file}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | $frame->{line}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | $c->config->{stacktrace}->{context} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 135 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 135 | $html .= qq{ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | <tr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | <td>$pkg</td> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | <td>$line</td> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | <td>$file</td> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | </tr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | <tr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | <td colspan="3"><pre><p><code class="error">$code_preview</code></p></pre></td> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | </tr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 6 | $html .= qq{ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | </table> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 6 | $c->res->{body} =~ s{<div class="infos">}{$html<div class="infos">}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 5 | ▶ | sub setup { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setup: called CC=3 SCAR=11.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 5 | my $c = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 5 | $c->next::method(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 5 | ▶ | $c->config->{stacktrace}->{context} ||= 3; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$c->config->{"stacktrace"}{"context"} ||= 3
MC/DC0%0/1
$c->config->{"stacktrace"}{"context"} ||= 3
$c->config->{"stacktrace"}{"context"}
Truth table50%1/2
A
A= $c->config->{"stacktrace"}{"context"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 5 | ▶ | $c->config->{stacktrace}->{verbose} ||= 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$c->config->{"stacktrace"}{"verbose"} ||= 0
MC/DC0%0/1
$c->config->{"stacktrace"}{"verbose"} ||= 0
$c->config->{"stacktrace"}{"verbose"}
Truth table50%1/2
A
A= $c->config->{"stacktrace"}{"verbose"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 135 | ▶ | sub _print_context { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_print_context: called CC=9 SCAR=22.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 135 | my ( $file, $linenum, $context ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 135 | my $code; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 135 | ▶ | if ( -f $file ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 135 | my $start = $linenum - $context; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 135 | my $end = $linenum + $context; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 135 | ▶ | $start = $start < 1 ? 1 : $start; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 135 | ▶ | if ( my $fh = IO::File->new( $file, 'r' ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 135 | my $cur_line = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 135 | ▶ | while ( my $line = <$fh> ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 44395 | ++$cur_line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 44395 | ▶ | last if $cur_line > $end; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 44261 | ▶ | next if $cur_line < $start; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 945 | ▶ | my @tag = $cur_line == $linenum ? ('<strong class="line">', '</strong>') : (q{}, q{}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 945 | ▶ | $code .= sprintf( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | '%s%5d: %s%s', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | $tag[0], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | $cur_line, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | $line ? encode_entities $line : q{}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | $tag[1], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 135 | return $code; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 6 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||