blib/lib/DTL/Fast/Tag.pm

filter: Statementstmt 95.4% 42 / 44 Branchbran 100% 4 / 4 Conditioncond 50.0% 3 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 92.8% 13 / 14 Podpod 0.0% 0 / 8 totaltotal 78.4% 62 / 79 SCAR 18.0
CC
6
Cov
91%
open_tag_syntax_with_line_number
2.1
get_block_parse_error
2.1
new
2.0
CRAP 6.0
« blib/lib/DTL/Fast/Filter/Getdigit.pm ↑ Summary blib/lib/DTL/Fast/Filter/Dictsort.pm »
1 package DTL::Fast::Tag;
2 36 ▶use strict; use utf8; use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
3 36 ▶use parent 'DTL::Fast::Parser';
Subroutine BEGIN: called CC=1 SCAR=0.0
4
5 36 ▶use DTL::Fast;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 36 ▶use DTL::Fast::Template;
Subroutine BEGIN: called CC=1 SCAR=0.0
7
8 sub new
9 {
10 843 ▶ my( $proto, $parameter, %kwargs ) = @_;
Subroutine new: called CC=2 SCAR=7.0
Pod undocumented
11 843 ▶ $parameter //= '';
Condition50%1/2
$parameter //= ""
l!l
8430
MC/DC0%0/1
$parameter //= ""
$parameter
Truth table50%1/2
A
A= $parameter
Aresult
11
00
12
13 843 $parameter =~ s/^\s+|\s+$//gs;
14
15 843 $kwargs{'parameter'} = $parameter;
16
17 843 return $proto->SUPER::new(%kwargs);
18 }
19
20 22 ▶sub parse_parameters{return shift;}
Subroutine parse_parameters: called CC=1 SCAR=0.0
Pod undocumented
21
22 sub parse_chunks
23 {
24 843 ▶ my( $self ) = @_;
Subroutine parse_chunks: called CC=2 SCAR=6.9
Pod undocumented
25 843 $self->parse_parameters();
26
27 $DTL::Fast::Template::CURRENT_TEMPLATE_LINE += $self->{'_open_tag_lines'}
28 828 ▶ if $self->{'_open_tag_lines'};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_open_tag_lines"} 50 778 828
29
30 828 return $self->SUPER::parse_chunks();
31 }
32
33 sub get_close_tag
34 {
35 0 ▶ my( $self ) = @_;
Subroutine get_close_tag: not called CC=1 SCAR=6.9
Pod undocumented
36 0 die sprintf(
37 "ABSTRACT method get_close_tag, must be overriden in %s"
38 , ref $self
39 );
40 }
41
42 # Close tag processor
43 sub parse_tag_chunk
44 {
45 946 ▶ my( $self, $tag_name, $tag_param, $chunk_lines ) = @_;
Subroutine parse_tag_chunk: called CC=2 SCAR=6.9
Pod undocumented
46
47 946 my $result = undef;
48
49 946 ▶ if( $tag_name eq $self->get_close_tag )
Branch: 1 branch
BranchTrueFalseTotal
if ($tag_name eq $self->get_close_tag) { } 640 306 946
50 {
51 640 $self->{'raw_chunks'} = []; # this stops parsing
52 640 $DTL::Fast::Template::CURRENT_TEMPLATE_LINE += $chunk_lines;
53 }
54 else
55 {
56 306 $result = $self->SUPER::parse_tag_chunk($tag_name, $tag_param, $chunk_lines);
57 }
58
59 922 return $result;
60 }
61
62 # returns restored opening tag
63 sub open_tag_syntax
64 {
65 2 ▶ my ($self) = @_;
Subroutine open_tag_syntax: called CC=1 SCAR=0.0
Pod undocumented
66
67 return join( ' ',
68 grep(
69 $_
70 , (
71 '{%'
72 , $DTL::Fast::KNOWN_SLUGS{ref $self}
73 2 , $self->{'parameter'}
74 , '%}'
75 )
76 )
77 );
78 }
79
80 # returns restored opening tag
81 sub open_tag_syntax_with_line_number
82 {
83 2 ▶ my ($self) = @_;
Subroutine open_tag_syntax_with_line_number: called CC=2 SCAR=7.2
Pod undocumented
84 2 ▶ return $self->open_tag_syntax().' at line '.($self->{'_template_line'} // 'unknown');
Condition50%1/2
$self->{"_template_line"} // "unknown"
l!l
20
MC/DC0%0/1
$self->{"_template_line"} // "unknown"
$self->{"_template_line"}
Truth table50%1/2
A
A= $self->{"_template_line"}
Aresult
11
00
85 }
86
87 sub get_block_parse_error
88 {
89 1 ▶ my ($self, $message) = @_;
Subroutine get_block_parse_error: called CC=2 SCAR=7.2
Pod undocumented
90 return $self->get_parse_error(
91 $message,
92 'Block' => sprintf(
93 '%s at line %s'
94 , ref $self
95 1 ▶ , $self->{'_template_line'} // 'unknown'
Condition50%1/2
$self->{"_template_line"} // "unknown"
l!l
10
MC/DC0%0/1
$self->{"_template_line"} // "unknown"
$self->{"_template_line"}
Truth table50%1/2
A
A= $self->{"_template_line"}
Aresult
11
00
96 )
97 );
98 }
99
100 36 1;
« blib/lib/DTL/Fast/Filter/Getdigit.pm ↑ Summary blib/lib/DTL/Fast/Filter/Dictsort.pm »