| 1 | package Devel::Trace::Subs::Text; | ||||||||||||||||||||||||||||||||
| 2 | 4 | ▶ | use 5.008; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 4 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||
| 6 | 4 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 7 | 4 | ▶ | use Exporter; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 8 | 4 | ▶ | use Template; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||
| 10 | 4 | our $VERSION = '0.24'; | |||||||||||||||||||||||||||||||
| 11 | 4 | our @ISA = qw(Exporter); | |||||||||||||||||||||||||||||||
| 12 | 4 | our @EXPORT_OK = qw(text); | |||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||
| 14 | 4 | my ($stack_tpl, $flow_tpl, $all_tpl); | |||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||
| 16 | 13 | ▶ | sub text { | ||||||||||||||||||||||||||||||
|
Subroutine
text: called CC=13 SCAR=26.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||
| 18 | 13 | my %p = @_; | |||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||
| 20 | 13 | my $file = $p{file}; | |||||||||||||||||||||||||||||||
| 21 | 13 | my $want = $p{want}; | |||||||||||||||||||||||||||||||
| 22 | 13 | my $data = $p{data}; | |||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||
| 24 | 13 | ▶ | if ($want && $want eq 'stack') { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
$want and $want eq "stack"
MC/DC100%2/2
$want and $want eq "stack"
$want
$want eq "stack"
Truth table100%3/3
A and B
A= $wantB= $want eq "stack"
| |||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||
| 26 | 4 | my $template = Template->new; | |||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||
| 28 | 4 | ▶ | if ($file) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||
| 30 | 3 | ▶ | $template->process( | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 31 | \$stack_tpl, | ||||||||||||||||||||||||||||||||
| 32 | {stack => $data}, | ||||||||||||||||||||||||||||||||
| 33 | $file | ||||||||||||||||||||||||||||||||
| 34 | ) || die $template->error; | ||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||
| 36 | else { | ||||||||||||||||||||||||||||||||
| 37 | 1 | ▶ | $template->process( | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 38 | \$stack_tpl, | ||||||||||||||||||||||||||||||||
| 39 | {stack => $data}, | ||||||||||||||||||||||||||||||||
| 40 | ) || die $template->error; | ||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||
| 43 | ▶ | elsif ($want && $want eq 'flow') { | |||||||||||||||||||||||||||||||
|
Condition66%2/3
$want and $want eq "flow"
MC/DC50%1/2
$want and $want eq "flow"
$want
$want eq "flow"
Truth table66%2/3
A and B
A= $wantB= $want eq "flow"
| |||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||
| 45 | 4 | my $template = Template->new; | |||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||
| 47 | 4 | ▶ | if ($file) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||
| 49 | 3 | ▶ | $template->process( | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 50 | \$flow_tpl, | ||||||||||||||||||||||||||||||||
| 51 | {flow => $data}, | ||||||||||||||||||||||||||||||||
| 52 | $file | ||||||||||||||||||||||||||||||||
| 53 | ) || die $template->error; | ||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||
| 55 | else { | ||||||||||||||||||||||||||||||||
| 56 | 1 | ▶ | $template->process( | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 57 | \$flow_tpl, | ||||||||||||||||||||||||||||||||
| 58 | {flow => $data} | ||||||||||||||||||||||||||||||||
| 59 | ) || die $template->error; | ||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||
| 62 | else { | ||||||||||||||||||||||||||||||||
| 63 | 5 | my $template = Template->new; | |||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||
| 65 | 5 | ▶ | if ($file) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||
| 67 | 4 | ▶ | $template->process( | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 68 | \$all_tpl, | ||||||||||||||||||||||||||||||||
| 69 | $data, | ||||||||||||||||||||||||||||||||
| 70 | $file, | ||||||||||||||||||||||||||||||||
| 71 | ) || die $template->error; | ||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||
| 73 | else { | ||||||||||||||||||||||||||||||||
| 74 | $template->process(\$all_tpl, { | ||||||||||||||||||||||||||||||||
| 75 | flow => $data->{flow}, | ||||||||||||||||||||||||||||||||
| 76 | stack => $data->{stack}, | ||||||||||||||||||||||||||||||||
| 77 | 1 | }); | |||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||
| 82 | 4 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||
| 84 | 4 | $flow_tpl = <<EOF; | |||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||
| 86 | Code flow: | ||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||
| 88 | [% FOREACH entry IN flow -%] | ||||||||||||||||||||||||||||||||
| 89 | [% entry.name %]: [% entry.value %] | ||||||||||||||||||||||||||||||||
| 90 | [% END %] | ||||||||||||||||||||||||||||||||
| 91 | EOF | ||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||
| 93 | 4 | $stack_tpl = <<EOF; | |||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||
| 95 | Stack trace: | ||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||
| 97 | [%- FOREACH entry IN stack %] | ||||||||||||||||||||||||||||||||
| 98 | in: [% entry.in %] | ||||||||||||||||||||||||||||||||
| 99 | sub: [% entry.sub %] | ||||||||||||||||||||||||||||||||
| 100 | file: [% entry.filename %] | ||||||||||||||||||||||||||||||||
| 101 | line: [% entry.line %] | ||||||||||||||||||||||||||||||||
| 102 | package: [% entry.package %] | ||||||||||||||||||||||||||||||||
| 103 | [% END %] | ||||||||||||||||||||||||||||||||
| 104 | EOF | ||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||
| 106 | 4 | $all_tpl = <<EOF; | |||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||
| 108 | Code flow: | ||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||
| 110 | [% FOREACH entry IN flow -%] | ||||||||||||||||||||||||||||||||
| 111 | [% entry.name %]: [% entry.value %] | ||||||||||||||||||||||||||||||||
| 112 | [% END %] | ||||||||||||||||||||||||||||||||
| 113 | Stack trace: | ||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||
| 115 | [%- FOREACH entry IN stack %] | ||||||||||||||||||||||||||||||||
| 116 | in: [% entry.in %] | ||||||||||||||||||||||||||||||||
| 117 | sub: [% entry.sub %] | ||||||||||||||||||||||||||||||||
| 118 | file: [% entry.filename %] | ||||||||||||||||||||||||||||||||
| 119 | line: [% entry.line %] | ||||||||||||||||||||||||||||||||
| 120 | package: [% entry.package %] | ||||||||||||||||||||||||||||||||
| 121 | [% END %] | ||||||||||||||||||||||||||||||||
| 122 | EOF | ||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||
| 124 | __END__ | ||||||||||||||||||||||||||||||||