| 1 | package Syntax::Kamelon::Format::Base; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use 5.006; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 3 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 3 | ▶ | use vars qw($VERSION); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 3 | $VERSION="0.15"; | |||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 3 | ▶ | use base qw(Template); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 3 | my $default_template = <<__EOF; | |||||||||||||||||||||||||||||||||||||||||
| 14 | [% IF lineoffset.defined ~%] | ||||||||||||||||||||||||||||||||||||||||||
| 15 | [% linenum = lineoffset ~%] | ||||||||||||||||||||||||||||||||||||||||||
| 16 | [% FOREACH line = content ~%] | ||||||||||||||||||||||||||||||||||||||||||
| 17 | [% linenum FILTER format('%03d ') ~%] | ||||||||||||||||||||||||||||||||||||||||||
| 18 | [% FOREACH snippet = line ~%] | ||||||||||||||||||||||||||||||||||||||||||
| 19 | [% snippet.tag %][% snippet.text %][% tagend ~%] | ||||||||||||||||||||||||||||||||||||||||||
| 20 | [% END %][% newline ~%] | ||||||||||||||||||||||||||||||||||||||||||
| 21 | [% linenum = linenum + 1 ~%] | ||||||||||||||||||||||||||||||||||||||||||
| 22 | [% END ~%] | ||||||||||||||||||||||||||||||||||||||||||
| 23 | [% ELSE ~%] | ||||||||||||||||||||||||||||||||||||||||||
| 24 | [% FOREACH line = content ~%] | ||||||||||||||||||||||||||||||||||||||||||
| 25 | [% FOREACH snippet = line ~%] | ||||||||||||||||||||||||||||||||||||||||||
| 26 | [% snippet.tag %][% snippet.text %][% tagend ~%] | ||||||||||||||||||||||||||||||||||||||||||
| 27 | [% END %][% newline ~%] | ||||||||||||||||||||||||||||||||||||||||||
| 28 | [% END ~%] | ||||||||||||||||||||||||||||||||||||||||||
| 29 | [% END ~%] | ||||||||||||||||||||||||||||||||||||||||||
| 30 | __EOF | ||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=13 SCAR=52.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | my $engine = shift; | |||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | my %args = (@_); | |||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | my $data = delete $args{data}; | |||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | ▶ | unless (defined $data) { $data = {} } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | my $foldingdepth = delete $args{foldingdepth}; | |||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | ▶ | unless (defined $foldingdepth) { $foldingdepth = 0 } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | my $formattable = delete $args{format_table}; | |||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | unless (defined($formattable)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | my %sub = (); | |||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | for ($engine->AvailableAttributes) { | |||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | $sub{$_} = $_, | |||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | $formattable = \%sub | |||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | my $minfoldsize = delete $args{minfoldsize}; | |||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | ▶ | unless (defined($minfoldsize)) { $minfoldsize = 1 } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | my $newline = delete $args{newline}; | |||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | unless (defined($newline)) { $newline = "\n" } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | my $offset = delete $args{lineoffset}; | |||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | my $outmet = delete $args{outmethod}; | |||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | unless (defined $outmet) { $outmet = "returnscalar" } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | my $tagend = delete $args{tagend}; | |||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | unless (defined $tagend) { $tagend = '' } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | my $template = delete $args{template}; | |||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | ▶ | unless (defined $template) { $template = \$default_template } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | my $textfilter = delete $args{textfilter}; | |||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | my $ttconfig = delete $args{ttconfig}; | |||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | if (%args) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | for (keys %args) { | |||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | warn "unrecognized option: $_" | |||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | my $self; | |||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | if (defined $ttconfig) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | $self= $class->SUPER::new($ttconfig) | |||||||||||||||||||||||||||||||||||||||||
| 81 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | $self= $class->SUPER::new() | |||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | $self->{DATA} = $data; | |||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | $self->{ENGINE} = $engine; | |||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | $self->{FOLDINGDEPTH} = $foldingdepth; | |||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | $self->{LINES} = []; | |||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | $self->{FOLDS} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | $self->{FOLDSTACK} = []; | |||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | $self->{FORMATTABLE} = $formattable; | |||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | $self->{LINEOFFSET} = $offset; | |||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | $self->{MINFOLDSIZE} = $minfoldsize; | |||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | $self->{NEWLINE} = $newline; | |||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | $self->{OUTMETHOD} = $outmet; | |||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | $self->{TAGEND} = $tagend; | |||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | $self->{TEMPLATE} = $template; | |||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | $self->TextFilter($textfilter); | |||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | sub Data { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Data: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | ▶ | if (@_) { $self->{DATA} = shift } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 106 | return $self->{DATA} | ||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | } | |||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | sub FindINC { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
FindINC: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | my ($self, $file) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | for (@INC) { | |||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | my $f = $_ . "/$file"; | |||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | ▶ | if (-e $f) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | return $f; | |||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | ▶ | sub FoldBegin { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
FoldBegin: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | my ($self, $region) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | my $eng = $self->{ENGINE}; | |||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | chomp(my $line = $eng->CurrentLine); | |||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | my %op = ( | |||||||||||||||||||||||||||||||||||||||||
| 125 | start => $eng->LineNumber, | ||||||||||||||||||||||||||||||||||||||||||
| 126 | region => $region, | ||||||||||||||||||||||||||||||||||||||||||
| 127 | line => $line | ||||||||||||||||||||||||||||||||||||||||||
| 128 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | $self->FoldStackPush(\%op); | |||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | sub FoldEnd { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
FoldEnd: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | my ($self, $region) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | my $eng = $self->{ENGINE}; | |||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | my $endline = $eng->LineNumber; | |||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | my $stacktop = $self->FoldStackTop; | |||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | my $foldingdepth = $self->{FOLDINGDEPTH}; | |||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | ▶ | if (($foldingdepth eq 'all') or ($self->FoldStackLevel <= $foldingdepth)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$foldingdepth eq "all" or $self->FoldStackLevel <= $foldingdepth
MC/DC0%0/2
$foldingdepth eq "all" or $self->FoldStackLevel <= $foldingdepth
$foldingdepth eq "all"
$self->FoldStackLevel <= $foldingdepth
Truth table0%0/3
A or B
A= $foldingdepth eq "all"B= $self->FoldStackLevel <= $foldingdepth
| |||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | ▶ | if (($endline - $stacktop->{start}) >= $self->{MINFOLDSIZE}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | my $beginline = delete $stacktop->{start}; | |||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | $stacktop->{end} = $endline; | |||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | $stacktop->{depth} = $self->FoldStackLevel; | |||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | $self->{FOLDS}->{$beginline} = $stacktop; | |||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | $self->FoldStackPull; | |||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | sub Folds { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Folds: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | return $self->{FOLDS}; | |||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | ▶ | sub Foldingdepth { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Foldingdepth: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | my $f = shift; | |||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | my $cf = $self->{FOLDINGDEPTH}; | |||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | ▶ | if (($f ne $cf) and (($f eq 0) or ($cf eq 0))){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$f ne $cf and $f eq 0 || $cf eq 0
$f eq 0 or $cf eq 0
MC/DC0%0/3
$f ne $cf and $f eq 0 || $cf eq 0
$f ne $cf
$f eq 0
$cf eq 0
Truth table0%0/4
A and B or C
A= $f ne $cfB= $f eq 0C= $cf eq 0
| |||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | $self->{FOLDINGDEPTH} = $f; | |||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | $self->{ENGINE}->ClearLexers; | |||||||||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | return $self->{FOLDINGDEPTH}; | |||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | ▶ | sub FoldStackLevel { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
FoldStackLevel: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | my $stack = $self->{FOLDSTACK}; | |||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | my $size = @$stack; | |||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | return $size | |||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | ▶ | sub FoldStackPull { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
FoldStackPull: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | my $stack = $self->{FOLDSTACK}; | |||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | return shift @$stack | |||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | ▶ | sub FoldStackPush { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
FoldStackPush: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | my $stack = $self->{FOLDSTACK}; | |||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | unshift @$stack, shift; | |||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | sub FoldStackTop { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
FoldStackTop: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | my $stack = $self->{FOLDSTACK}; | |||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | return $stack->[0] | |||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | ▶ | sub Format { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Format: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | my $out = ''; | |||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | my $outmet = $self->{OUTMETHOD}; | |||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | if ($outmet eq 'returnscalar') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | $outmet = \$out | |||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | my $template = $self->{TEMPLATE}; | |||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | ▶ | $self->process($template, $self->GetData, $outmet) || do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | my $error = $self->error(); | |||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | print STDERR "error type: ", $error->type(), "\n"; | |||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | print STDERR "error info: ", $error->info(), "\n"; | |||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | print STDERR $error, "\n"; | |||||||||||||||||||||||||||||||||||||||||
| 205 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | return $out | |||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | ▶ | sub FormatTable { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
FormatTable: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | my $key = shift; | |||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | ▶ | if (defined $key) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | my $t = $self->{FORMATTABLE}; | |||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | ▶ | if (@_) { $t->{$key} = shift; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | ▶ | if (exists $t->{$key}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | return $t->{$key}; | |||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||
| 219 | return undef | ||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | } | |||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | ▶ | sub GetData { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
GetData: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | my $dt = $self->{DATA}; | |||||||||||||||||||||||||||||||||||||||||
| 225 | my %data = (%$dt, | ||||||||||||||||||||||||||||||||||||||||||
| 226 | folds => $self->{FOLDS}, | ||||||||||||||||||||||||||||||||||||||||||
| 227 | content => $self->{LINES}, | ||||||||||||||||||||||||||||||||||||||||||
| 228 | lineoffset => $self->{LINEOFFSET}, | ||||||||||||||||||||||||||||||||||||||||||
| 229 | newline => $self->{NEWLINE}, | ||||||||||||||||||||||||||||||||||||||||||
| 230 | tagend => $self->{TAGEND}, | ||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | return \%data; | |||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | ▶ | sub LineOffset { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
LineOffset: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | ▶ | if (@_) { $self->{LINEOFFSET} = shift } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 238 | return $self->{LINEOFFSET} | ||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | } | |||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | ▶ | sub Lines { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Lines: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 243 | return $self->{LINES} | ||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | } | |||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | ▶ | sub MinFoldSize { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
MinFoldSize: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | ▶ | if (@_) { $self->{MINFOLDSIZE} = shift } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 249 | return $self->{MINFOLDSIZE} | ||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | } | |||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | ▶ | sub OutMethod { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
OutMethod: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | ▶ | if (@_) { $self->{OUTMETHOD} = shift } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 255 | return $self->{OUTMETHOD} | ||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | } | |||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | ▶ | sub Parse { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Parse: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | my @line = (); | |||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | ▶ | while (@_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | my $text = shift; | |||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | my $call = $self->{PREPROCESSOR}; | |||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | $text = &$call($self, $text); | |||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | my %tok = ( | |||||||||||||||||||||||||||||||||||||||||
| 266 | text => $text, | ||||||||||||||||||||||||||||||||||||||||||
| 267 | tag => shift, | ||||||||||||||||||||||||||||||||||||||||||
| 268 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | push @line, \%tok | |||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | my $fl = $self->{LINES}; | |||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | push @$fl, \@line | |||||||||||||||||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | ▶ | sub PreProcessOff { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
PreProcessOff: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | my ($self, $text) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | return $text | |||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | ▶ | sub PreProcessOn { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
PreProcessOn: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | my ($self, $text) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | return $self->Process($self->{TEXTFILTER}, { text => $text }) | |||||||||||||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | ▶ | sub Process { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Process: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | my ($self, $template, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | my $out = ''; | |||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | ▶ | $self->process($template, $data, \$out) || do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | my $error = $self->error(); | |||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | print STDERR "error type: ", $error->type(), "\n"; | |||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | print STDERR "error info: ", $error->info(), "\n"; | |||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | print STDERR $error, "\n"; | |||||||||||||||||||||||||||||||||||||||||
| 293 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | return $out | |||||||||||||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | ▶ | sub Reset { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Reset: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | $self->{FOLDS} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | $self->{FOLDSTACK} = []; | |||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | $self->{LINES} = []; | |||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | ▶ | sub TagEnd { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
TagEnd: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | ▶ | if (@_) { $self->{TAGEND} = shift } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 307 | return $self->{TAGEND} | ||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | } | |||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | ▶ | sub Template { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Template: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | ▶ | if (@_) { $self->{TEMPLATE} = shift } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 313 | return $self->{TEMPLATE} | ||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | } | |||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | ▶ | sub TextFilter { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
TextFilter: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | my $filt = shift; | |||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | ▶ | if (defined $filt) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | $self->{PREPROCESSOR} = $self->can('PreProcessOn') | |||||||||||||||||||||||||||||||||||||||||
| 322 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | $self->{PREPROCESSOR} = $self->can('PreProcessOff') | |||||||||||||||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | $self->{TEXTFILTER} = $filt | |||||||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||||||
| 327 | return $self->{TEXTFILTER} | ||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | } | |||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||
| 330 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 331 | __END__ | ||||||||||||||||||||||||||||||||||||||||||