Tiny/_CSS.pm

filter: Statementstmt 97.2% 140 / 144 Branchbran 95.0% 152 / 160 Conditioncond 86.9% 20 / 23 MC/DCmcdc 80.0% 12 / 15 Subroutinesub 100% 22 / 22 Podpod 0.0% 0 / 5 totaltotal 93.7% 346 / 369 SCAR 45.6
CC
95
Cov
95%
_pc
19.0
_compile
19.0
_equation
9.0
CRAP 95.9
↑ Summary Tiny.pm »
1 package DOM::Tiny::_CSS;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 our $VERSION = '0.003';
7  
8 1 my $ESCAPE_RE = qr/\\[^0-9a-fA-F]|\\[0-9a-fA-F]{1,6}/;
9 1 my $ATTR_RE = qr/
10 \[
11 ((?:$ESCAPE_RE|[\w\-])+) # Key
12 (?:
13 (\W)?= # Operator
14 (?:"((?:\\"|[^"])*)"|'((?:\\'|[^'])*)'|([^\]]+?)) # Value
15 (?:\s+(i))? # Case-sensitivity
16 )?
17 \]
18 /x;
19  
20 sub new {
21 871 ▶ my $class = shift;
Subroutine new: called CC=4 SCAR=17.9
Pod undocumented
22 871 ▶ bless @_ ? @_ > 1 ? {@_} : {%{$_[0]}} : {}, ref $class || $class;
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 871 0 871
@_ > 1 ? : 871 0 871
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
08710
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
23 }
24  
25 sub tree {
26 871 ▶ my $self = shift;
Subroutine tree: called CC=2 SCAR=9.2
Pod undocumented
27 871 ▶ return $self->{tree} unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 871 0 871
28 0 $self->{tree} = shift;
29 0 return $self;
30 }
31  
32 sub matches {
33 29 ▶ my $tree = shift->tree;
Subroutine matches: called CC=2 SCAR=6.9
Pod undocumented
34 29 ▶ return $tree->[0] ne 'tag' ? undef : _match(_compile(shift), $tree, $tree);
Branch: 1 branch
BranchTrueFalseTotal
$tree->[0] ne 'tag' ? : 1 28 29
35 }
36  
37 389 ▶sub select { _select(0, shift->tree, _compile(@_)) }
Subroutine select: called CC=1 SCAR=0.0
Pod undocumented
38 453 ▶sub select_one { _select(1, shift->tree, _compile(@_)) }
Subroutine select_one: called CC=1 SCAR=0.0
Pod undocumented
39  
40 sub _ancestor {
41 1295 ▶ my ($selectors, $current, $tree, $one, $pos) = @_;
Subroutine _ancestor: called CC=6 SCAR=17.9
42  
43 1295 ▶ while ($current = $current->[3]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($current = $current->[3]) 1363 0 1363
44 1363 ▶ return undef if $current->[0] eq 'root' || $current eq $tree;
Branch: 1 branch
BranchTrueFalseTotal
if $current->[0] eq "root" or $current eq $tree 82 1281 1363
Condition100%3/3
$current->[0] eq "root" or $current eq $tree
l!l&&r!l&&!r
8021281
MC/DC100%2/2
$current->[0] eq "root" or $current eq $tree
$current->[0] eq "root" $current eq $tree
Truth table100%3/3
A or B
A= $current->[0] eq "root"B= $current eq $tree
ABresult
1X1
011
000
45 1281 ▶ return 1 if _combinator($selectors, $current, $tree, $pos);
Branch: 1 branch
BranchTrueFalseTotal
if _combinator($selectors, $current, $tree, $pos) 1076 205 1281
46 205 ▶ last if $one;
Branch: 1 branch
BranchTrueFalseTotal
if $one 137 68 205
47 }
48  
49 137 return undef;
50 }
51  
52 sub _attr {
53 981 ▶ my ($name_re, $value_re, $current) = @_;
Subroutine _attr: called CC=6 SCAR=17.9
54  
55 981 my $attrs = $current->[2];
56 981 for my $name (keys %$attrs) {
57 837 ▶ next unless $name =~ $name_re;
Branch: 1 branch
BranchTrueFalseTotal
unless $name =~ /$name_re/ 306 531 837
58 531 ▶ return 1 unless defined $attrs->{$name} && defined $value_re;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $attrs->{$name} and defined $value_re 34 497 531
Condition100%3/3
defined $attrs->{$name} and defined $value_re
!ll&&!rl&&r
331497
MC/DC100%2/2
defined $attrs->{$name} and defined $value_re
defined $attrs->{$name} defined $value_re
Truth table100%3/3
A and B
A= defined $attrs->{$name}B= defined $value_re
ABresult
0X0
100
111
59 497 ▶ return 1 if $attrs->{$name} =~ $value_re;
Branch: 1 branch
BranchTrueFalseTotal
if $attrs->{$name} =~ /$value_re/ 309 188 497
60 }
61  
62 638 return undef;
63 }
64  
65 sub _combinator {
66 6877 ▶ my ($selectors, $current, $tree, $pos) = @_;
Subroutine _combinator: called CC=8 SCAR=20.8
67  
68 # Selector
69 6877 ▶ return undef unless my $c = $selectors->[$pos];
Branch: 1 branch
BranchTrueFalseTotal
unless my $c = $selectors->[$pos] 0 6877 6877
70 6877 ▶ if (ref $c) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $c) 6877 0 6877
71 6877 ▶ return undef unless _selector($c, $current);
Branch: 1 branch
BranchTrueFalseTotal
unless _selector($c, $current) 4083 2794 6877
72 2794 ▶ return 1 unless $c = $selectors->[++$pos];
Branch: 1 branch
BranchTrueFalseTotal
unless $c = $$selectors[++$pos] 1402 1392 2794
73 }
74  
75 # ">" (parent only)
76 1392 ▶ return _ancestor($selectors, $current, $tree, 1, ++$pos) if $c eq '>';
Branch: 1 branch
BranchTrueFalseTotal
if $c eq ">" 874 518 1392
77  
78 # "~" (preceding siblings)
79 518 ▶ return _sibling($selectors, $current, $tree, 0, ++$pos) if $c eq '~';
Branch: 1 branch
BranchTrueFalseTotal
if $c eq "~" 45 473 518
80  
81 # "+" (immediately preceding siblings)
82 473 ▶ return _sibling($selectors, $current, $tree, 1, ++$pos) if $c eq '+';
Branch: 1 branch
BranchTrueFalseTotal
if $c eq "+" 52 421 473
83  
84 # " " (ancestor)
85 421 return _ancestor($selectors, $current, $tree, 0, ++$pos);
86 }
87  
88 sub _compile {
89 898 ▶ my $css = "$_[0]";
Subroutine _compile: called CC=19 SCAR=29.4
90 898 $css =~ s/^\s+//;
91 898 $css =~ s/\s+$//;
92  
93 898 my $group = [[]];
94 898 ▶ while (my $selectors = $group->[-1]) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $selectors = $group->[-1]) 3244 0 3244
95 3244 ▶ push @$selectors, [] unless @$selectors && ref $selectors->[-1];
Branch: 1 branch
BranchTrueFalseTotal
unless @$selectors and ref $selectors->[-1] 1497 1747 3244
Condition100%3/3
@$selectors and ref $selectors->[-1]
!ll&&!rl&&r
9055921747
MC/DC100%2/2
@$selectors and ref $selectors->[-1]
@$selectors ref $selectors->[-1]
Truth table100%3/3
A and B
A= @$selectorsB= ref $selectors->[-1]
ABresult
0X0
100
111
96 3244 my $last = $selectors->[-1];
97  
98 # Separator
99 3244 ▶ if ($css =~ /\G\s*,\s*/gc) { push @$group, [] }
Branch: 6 branches
BranchTrueFalseTotal
if ($css =~ /\G\s*,\s*/cg) { } 7 3237 3244
elsif ($css =~ /\G\s*([ >+~])\s*/cg) { } 592 2645 3237
elsif ($css =~ /\G([.#])((?:$ESCAPE_RE\s|\\.|[^,.#:[ >~+])+)/cog) { } 131 2514 2645
elsif ($css =~ /\G$ATTR_RE/cog) { } 197 2317 2514
elsif ($css =~ /\G:([\w\-]+)(?:\(((?:\([^)]+\)|[^)])+)\))?/cgs) { } 179 2138 2317
elsif ($css =~ /\G((?:$ESCAPE_RE\s|\\.|[^,.#:[ >~+])+)/cog) { } 1240 898 2138
100  
101 # Combinator
102 592 elsif ($css =~ /\G\s*([ >+~])\s*/gc) { push @$selectors, $1 }
103  
104 # Class or ID
105 elsif ($css =~ /\G([.#])((?:$ESCAPE_RE\s|\\.|[^,.#:[ >~+])+)/gco) {
106 131 ▶ my ($name, $op) = $1 eq '.' ? ('class', '~') : ('id', '');
Branch: 1 branch
BranchTrueFalseTotal
$1 eq '.' ? : 41 90 131
107 131 push @$last, ['attr', _name($name), _value($op, $2)];
108 }
109  
110 # Attributes
111 elsif ($css =~ /\G$ATTR_RE/gco) {
112 197 ▶ push @$last, [
Branch: 3 branches
BranchTrueFalseTotal
defined $2 ? : 94 103 197
defined $3 ? : 92 105 197
defined $4 ? : 2 103 105
113 'attr', _name($1),
114 _value(
115 defined($2) ? $2 : '',
116 defined($3) ? $3 : defined($4) ? $4 : $5,
117 $6
118 ),
119 ];
120 }
121  
122 # Pseudo-class
123 elsif ($css =~ /\G:([\w\-]+)(?:\(((?:\([^)]+\)|[^)])+)\))?/gcs) {
124 179 my ($name, $args) = (lc $1, $2);
125  
126 # ":not" (contains more selectors)
127 179 ▶ $args = _compile($args) if $name eq 'not';
Branch: 1 branch
BranchTrueFalseTotal
if $name eq "not" 28 151 179
128  
129 # ":nth-*" (with An+B notation)
130 179 ▶ $args = _equation($args) if $name =~ /^nth-/;
Branch: 1 branch
BranchTrueFalseTotal
if $name =~ /^nth-/ 98 81 179
131  
132 # ":first-*" (rewrite to ":nth-*")
133 179 ▶ ($name, $args) = ("nth-$1", [0, 1]) if $name =~ /^first-(.+)$/;
Branch: 1 branch
BranchTrueFalseTotal
if $name =~ /^first-(.+)$/ 4 175 179
134  
135 # ":last-*" (rewrite to ":nth-*")
136 179 ▶ ($name, $args) = ("nth-$name", [-1, 1]) if $name =~ /^last-/;
Branch: 1 branch
BranchTrueFalseTotal
if $name =~ /^last-/ 12 167 179
137  
138 179 push @$last, ['pc', $name, $args];
139 }
140  
141 # Tag
142 elsif ($css =~ /\G((?:$ESCAPE_RE\s|\\.|[^,.#:[ >~+])+)/gco) {
143 1240 ▶ push @$last, ['tag', _name($1)] unless $1 eq '*';
Branch: 1 branch
BranchTrueFalseTotal
unless $1 eq "*" 1226 14 1240
144 }
145  
146 898 else {last}
147 }
148  
149 898 return $group;
150 }
151  
152 58 ▶sub _empty { $_[0][0] eq 'comment' || $_[0][0] eq 'pi' }
Subroutine _empty: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
$_[0][0] eq "comment" or $_[0][0] eq "pi" 56 2 58
153  
154 sub _equation {
155 98 ▶ return [0, 0] unless my $equation = shift;
Subroutine _equation: called CC=9 SCAR=22.0
Branch: 1 branch
BranchTrueFalseTotal
unless my $equation = shift() 2 96 98
156  
157 # "even"
158 96 ▶ return [2, 2] if $equation =~ /^\s*even\s*$/i;
Branch: 1 branch
BranchTrueFalseTotal
if $equation =~ /^\s*even\s*$/i 9 87 96
159  
160 # "odd"
161 87 ▶ return [2, 1] if $equation =~ /^\s*odd\s*$/i;
Branch: 1 branch
BranchTrueFalseTotal
if $equation =~ /^\s*odd\s*$/i 12 75 87
162  
163 # "4", "+4" or "-4"
164 75 ▶ return [0, $1] if $equation =~ /^\s*((?:\+|-)?\d+)\s*$/;
Branch: 1 branch
BranchTrueFalseTotal
if $equation =~ /^\s*((?:\+|-)?\d+)\s*$/ 24 51 75
165  
166 # "n", "4n", "+4n", "-4n", "n+1", "4n-1", "+4n-1" (and other variations)
167 51 ▶ return [0, 0]
Branch: 1 branch
BranchTrueFalseTotal
unless $equation =~ /^\s*((?:\+|-)?(?:\d+)?)?n\s*((?:\+|-)\s*\d+)?\s*$/i 1 50 51
168 unless $equation =~ /^\s*((?:\+|-)?(?:\d+)?)?n\s*((?:\+|-)\s*\d+)?\s*$/i;
169 50 ▶ return [$1 eq '-' ? -1 : !length $1 ? 1 : $1, join('', split(' ', $2 || 0))];
Branch: 2 branches
BranchTrueFalseTotal
$1 eq '-' ? : 17 33 50
!length($1) ? : 6 27 33
Condition100%2/2
$2 || 0
l!l
419
MC/DC100%1/1
$2 || 0
$2
Truth table100%2/2
A
A= $2
Aresult
11
00
170 }
171  
172 sub _match {
173 5391 ▶ my ($group, $current, $tree) = @_;
Subroutine _match: called CC=3 SCAR=11.0
174 5391 ▶ _combinator([reverse @$_], $current, $tree, 0) and return 1 for @$group;
Branch: 1 branch
BranchTrueFalseTotal
_combinator([reverse(@$_)], $current, $tree, 0) and return 1 1398 4011 5409
175 3993 return undef;
176 }
177  
178 1554 ▶sub _name {qr/(?:^|:)\Q@{[_unescape(shift)]}\E$/}
Subroutine _name: called CC=1 SCAR=0.0
179  
180 sub _pc {
181 1354 ▶ my ($class, $args, $current) = @_;
Subroutine _pc: called CC=19 SCAR=29.4
182  
183 # ":checked"
184 return exists $current->[2]{checked} || exists $current->[2]{selected}
185 1354 ▶ if $class eq 'checked';
Branch: 1 branch
BranchTrueFalseTotal
if $class eq "checked" 201 1153 1354
Condition100%3/3
exists $current->[2]{'checked'} || exists $current->[2]{'selected'}
l!l&&r!l&&!r
2532144
MC/DC100%2/2
exists $current->[2]{'checked'} || exists $current->[2]{'selected'}
exists $current->[2]{'checked'} exists $current->[2]{'selected'}
Truth table100%3/3
A || B
A= exists $current->[2]{'checked'}B= exists $current->[2]{'selected'}
ABresult
1X1
011
000
186  
187 # ":not"
188 1153 ▶ return !_match($args, $current, $current) if $class eq 'not';
Branch: 1 branch
BranchTrueFalseTotal
if $class eq "not" 126 1027 1153
189  
190 # ":empty"
191 1027 ▶ return !grep { !_empty($_) } @$current[4 .. $#$current] if $class eq 'empty';
Branch: 1 branch
BranchTrueFalseTotal
if $class eq "empty" 24 1003 1027
192  
193 # ":root"
194 1003 ▶ return $current->[3] && $current->[3][0] eq 'root' if $class eq 'root';
Branch: 1 branch
BranchTrueFalseTotal
if $class eq "root" 47 956 1003
Condition66%2/3
$current->[3] && $current->[3][0] eq 'root'
!ll&&!rl&&r
0425
MC/DC50%1/2
$current->[3] && $current->[3][0] eq 'root'
$current->[3] $current->[3][0] eq 'root'
Truth table66%2/3
A && B
A= $current->[3]B= $current->[3][0] eq 'root'
ABresult
0X0
100
111
195  
196 # ":nth-child", ":nth-last-child", ":nth-of-type" or ":nth-last-of-type"
197 956 ▶ if (ref $args) {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $args) { } 908 48 956
elsif ($class eq 'only-child' or $class eq 'only-of-type') { } 40 8 48
198 908 ▶ my $type = $class =~ /of-type$/ ? $current->[1] : undef;
Branch: 1 branch
BranchTrueFalseTotal
$class =~ /of-type$/ ? : 73 835 908
199 908 my @siblings = @{_siblings($current, $type)};
200 908 ▶ @siblings = reverse @siblings if $class =~ /^nth-last/;
Branch: 1 branch
BranchTrueFalseTotal
if $class =~ /^nth-last/ 326 582 908
201  
202 908 for my $i (0 .. $#siblings) {
203 3951 ▶ next if (my $result = $args->[0] * $i + $args->[1]) < 1;
Branch: 1 branch
BranchTrueFalseTotal
if (my $result = $args->[0] * $i + $args->[1]) < 1 1103 2848 3951
204 2848 ▶ last unless my $sibling = $siblings[$result - 1];
Branch: 1 branch
BranchTrueFalseTotal
unless my $sibling = $siblings[$result - 1] 178 2670 2848
205 2670 ▶ return 1 if $sibling eq $current;
Branch: 1 branch
BranchTrueFalseTotal
if $sibling eq $current 381 2289 2670
206 }
207 }
208  
209 # ":only-child" or ":only-of-type"
210 ▶ elsif ($class eq 'only-child' || $class eq 'only-of-type') {
Condition100%3/3
$class eq "only-child" or $class eq "only-of-type"
l!l&&r!l&&!r
20208
MC/DC100%2/2
$class eq "only-child" or $class eq "only-of-type"
$class eq "only-child" $class eq "only-of-type"
Truth table100%3/3
A or B
A= $class eq "only-child"B= $class eq "only-of-type"
ABresult
1X1
011
000
211 40 ▶ my $type = $class eq 'only-of-type' ? $current->[1] : undef;
Branch: 1 branch
BranchTrueFalseTotal
$class eq 'only-of-type' ? : 20 20 40
212 40 ▶ $_ ne $current and return undef for @{_siblings($current, $type)};
Branch: 1 branch
BranchTrueFalseTotal
$_ ne $current and return undef 33 15 48
213 7 return 1;
214 }
215  
216 535 return undef;
217 }
218  
219 sub _select {
220 842 ▶ my ($one, $tree, $group) = @_;
Subroutine _select: called CC=7 SCAR=19.5
221  
222 842 my @results;
223 842 ▶ my @queue = @$tree[($tree->[0] eq 'root' ? 1 : 4) .. $#$tree];
Branch: 1 branch
BranchTrueFalseTotal
$tree->[0] eq 'root' ? : 807 35 842
224 842 ▶ while (my $current = shift @queue) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $current = shift @queue) 13226 424 13650
225 13226 ▶ next unless $current->[0] eq 'tag';
Branch: 1 branch
BranchTrueFalseTotal
unless $current->[0] eq "tag" 7989 5237 13226
226  
227 5237 unshift @queue, @$current[4 .. $#$current];
228 5237 ▶ next unless _match($group, $current, $tree);
Branch: 1 branch
BranchTrueFalseTotal
unless _match($group, $current, $tree) 3888 1349 5237
229 1349 ▶ $one ? return $current : push @results, $current;
Branch: 1 branch
BranchTrueFalseTotal
$one ? : 418 931 1349
230 }
231  
232 424 ▶ return $one ? undef : \@results;
Branch: 1 branch
BranchTrueFalseTotal
$one ? : 35 389 424
233 }
234  
235 sub _selector {
236 6877 ▶ my ($selector, $current) = @_;
Subroutine _selector: called CC=8 SCAR=20.8
237  
238 6877 for my $s (@$selector) {
239 7763 my $type = $s->[0];
240  
241 # Tag
242 7763 ▶ if ($type eq 'tag') { return undef unless $current->[1] =~ $s->[1] }
Branch: 4 branches
BranchTrueFalseTotal
if ($type eq 'tag') { } 5428 2335 7763
elsif ($type eq 'attr') { } 981 1354 2335
elsif ($type eq 'pc') { } 1354 0 1354
unless $current->[1] =~ /$s->[1]/ 2646 2782 5428
243  
244 # Attribute
245 981 ▶ elsif ($type eq 'attr') { return undef unless _attr(@$s[1, 2], $current) }
Branch: 1 branch
BranchTrueFalseTotal
unless _attr(@$s[1, 2], $current) 638 343 981
246  
247 # Pseudo-class
248 1354 ▶ elsif ($type eq 'pc') { return undef unless _pc(@$s[1, 2], $current) }
Branch: 1 branch
BranchTrueFalseTotal
unless _pc(@$s[1, 2], $current) 799 555 1354
249 }
250  
251 2794 return 1;
252 }
253  
254 sub _sibling {
255 97 ▶ my ($selectors, $current, $tree, $immediate, $pos) = @_;
Subroutine _sibling: called CC=5 SCAR=16.1
256  
257 97 my $found;
258 97 for my $sibling (@{_siblings($current)}) {
259 261 ▶ return $found if $sibling eq $current;
Branch: 1 branch
BranchTrueFalseTotal
if $sibling eq $current 74 187 261
260  
261 # "+" (immediately preceding sibling)
262 187 ▶ if ($immediate) { $found = _combinator($selectors, $sibling, $tree, $pos) }
Branch: 1 branch
BranchTrueFalseTotal
if ($immediate) { } 108 79 187
263  
264 # "~" (preceding sibling)
265 79 ▶ else { return 1 if _combinator($selectors, $sibling, $tree, $pos) }
Branch: 1 branch
BranchTrueFalseTotal
if _combinator($selectors, $sibling, $tree, $pos) 23 56 79
266 }
267  
268 0 return undef;
269 }
270  
271 sub _siblings {
272 1045 ▶ my ($current, $type) = @_;
Subroutine _siblings: called CC=3 SCAR=11.0
273  
274 1045 my $parent = $current->[3];
275 1045 ▶ my @siblings = grep { $_->[0] eq 'tag' }
Branch: 1 branch
BranchTrueFalseTotal
$parent->[0] eq 'root' ? : 186 859 1045
276 @$parent[($parent->[0] eq 'root' ? 1 : 4) .. $#$parent];
277 1045 ▶ @siblings = grep { $type eq $_->[1] } @siblings if defined $type;
Branch: 1 branch
BranchTrueFalseTotal
if defined $type 93 952 1045
278  
279 1045 return \@siblings;
280 }
281  
282 sub _unescape {
283 1855 ▶ my $value = shift;
Subroutine _unescape: called CC=1 SCAR=0.0
284  
285 # Remove escaped newlines
286 1855 $value =~ s/\\\n//g;
287  
288 # Unescape Unicode characters
289 1855 $value =~ s/\\([0-9a-fA-F]{1,6})\s?/pack 'U', hex $1/ge;
290  
291 # Remove backslash
292 1855 $value =~ s/\\//g;
293  
294 1855 return $value;
295 }
296  
297 sub _value {
298 328 ▶ my ($op, $value, $insensitive) = @_;
Subroutine _value: called CC=7 SCAR=19.5
299 328 ▶ return undef unless defined $value;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 27 301 328
300 301 ▶ $value = ($insensitive ? '(?i)' : '') . quotemeta _unescape($value);
Branch: 1 branch
BranchTrueFalseTotal
$insensitive ? : 7 294 301
301  
302 # "~=" (word)
303 301 ▶ return qr/(?:^|\s+)$value(?:\s+|$)/ if $op eq '~';
Branch: 1 branch
BranchTrueFalseTotal
if $op eq "~" 63 238 301
304  
305 # "*=" (contains)
306 238 ▶ return qr/$value/ if $op eq '*';
Branch: 1 branch
BranchTrueFalseTotal
if $op eq "*" 11 227 238
307  
308 # "^=" (begins with)
309 227 ▶ return qr/^$value/ if $op eq '^';
Branch: 1 branch
BranchTrueFalseTotal
if $op eq "^" 30 197 227
310  
311 # "$=" (ends with)
312 197 ▶ return qr/$value$/ if $op eq '$';
Branch: 1 branch
BranchTrueFalseTotal
if $op eq "\$" 31 166 197
313  
314 # Everything else
315 166 return qr/^$value$/;
316 }
317  
318 1 1;
319  
320 =for Pod::Coverage *EVERYTHING*
321  
322 =cut
↑ Summary Tiny.pm »