| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
1
|
|
|
1
|
|
9
|
use v5.36.0; |
|
|
1
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
|
|
package Sieve::Generator::Lines::Junction 0.001; |
|
3
|
|
|
|
|
|
|
# ABSTRACT: a Sieve allof/anyof/noneof test |
|
4
|
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
4
|
use Moo; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
28
|
|
|
6
|
|
|
|
|
|
|
with 'Sieve::Generator::Lines'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
|
9
|
|
|
|
|
|
|
#pod |
|
10
|
|
|
|
|
|
|
#pod A junction renders a Sieve multi-test expression: C, |
|
11
|
|
|
|
|
|
|
#pod C, or C (for C). Each contained test is |
|
12
|
|
|
|
|
|
|
#pod rendered on its own indented line. |
|
13
|
|
|
|
|
|
|
#pod |
|
14
|
|
|
|
|
|
|
#pod =attr type |
|
15
|
|
|
|
|
|
|
#pod |
|
16
|
|
|
|
|
|
|
#pod This attribute holds the junction type. It must be one of C, |
|
17
|
|
|
|
|
|
|
#pod C, or C. |
|
18
|
|
|
|
|
|
|
#pod |
|
19
|
|
|
|
|
|
|
#pod =cut |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
#pod =attr things |
|
22
|
|
|
|
|
|
|
#pod |
|
23
|
|
|
|
|
|
|
#pod This attribute holds the list of tests in the junction. Each may be a plain |
|
24
|
|
|
|
|
|
|
#pod string or an object doing L or |
|
25
|
|
|
|
|
|
|
#pod L. |
|
26
|
|
|
|
|
|
|
#pod |
|
27
|
|
|
|
|
|
|
#pod =cut |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has type => (is => 'ro', required => 1); |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
has _things => (is => 'ro', init_arg => 'things', required => 1); |
|
32
|
5
|
|
|
5
|
1
|
8
|
sub things ($self) { $self->_things->@* } |
|
|
5
|
|
|
|
|
9
|
|
|
|
5
|
|
|
|
|
6
|
|
|
|
5
|
|
|
|
|
63
|
|
|
33
|
|
|
|
|
|
|
|
|
34
|
5
|
|
|
5
|
0
|
9
|
sub as_sieve ($self, $i = undef) { |
|
|
5
|
|
|
|
|
9
|
|
|
|
5
|
|
|
|
|
8
|
|
|
|
5
|
|
|
|
|
9
|
|
|
35
|
5
|
|
50
|
|
|
17
|
my $indent = q{ } x ($i // 0); |
|
36
|
|
|
|
|
|
|
|
|
37
|
5
|
|
|
|
|
15
|
my $type = $self->type; |
|
38
|
5
|
50
|
|
|
|
45
|
my $func = $type eq 'anyof' ? 'anyof' |
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
: $type eq 'allof' ? 'allof' |
|
40
|
|
|
|
|
|
|
: $type eq 'noneof' ? 'not anyof' |
|
41
|
|
|
|
|
|
|
: die "unknown junction type"; |
|
42
|
|
|
|
|
|
|
|
|
43
|
5
|
|
|
|
|
13
|
my $str = "${indent}$func(\n"; |
|
44
|
|
|
|
|
|
|
|
|
45
|
5
|
|
|
|
|
9
|
my @strs; |
|
46
|
5
|
|
|
|
|
13
|
for my $thing ($self->things) { |
|
47
|
10
|
50
|
|
|
|
40
|
my $substr = ref $thing ? $thing->as_sieve($i+1) : $thing; |
|
48
|
10
|
|
|
|
|
20
|
chomp $substr; |
|
49
|
10
|
|
|
|
|
22
|
push @strs, $substr; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
5
|
|
|
|
|
17
|
$str .= join qq{,\n}, @strs; |
|
53
|
5
|
|
|
|
|
9
|
$str .= "\n${indent})\n"; |
|
54
|
|
|
|
|
|
|
|
|
55
|
5
|
|
|
|
|
17
|
return $str; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
1
|
|
|
1
|
|
526
|
no Moo; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
8
|
|
|
59
|
|
|
|
|
|
|
1; |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |