line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
7
|
|
|
7
|
|
264461
|
use v5.10; |
|
7
|
|
|
|
|
27
|
|
3
|
7
|
|
|
7
|
|
31
|
use strict; |
|
7
|
|
|
|
|
12
|
|
|
7
|
|
|
|
|
137
|
|
4
|
7
|
|
|
7
|
|
28
|
use warnings; |
|
7
|
|
|
|
|
11
|
|
|
7
|
|
|
|
|
362
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Context::Singleton::Frame::Builder::Base; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = v1.0.5; |
9
|
|
|
|
|
|
|
|
10
|
7
|
|
|
7
|
|
3256
|
use List::MoreUtils; |
|
7
|
|
|
|
|
65556
|
|
|
7
|
|
|
|
|
60
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
13
|
335
|
|
|
335
|
0
|
98074
|
my ($class, %params) = @_; |
14
|
|
|
|
|
|
|
|
15
|
335
|
|
100
|
|
|
1212
|
$params{default} //= {}; |
16
|
|
|
|
|
|
|
|
17
|
335
|
|
|
|
|
509
|
my $self = bless \%params, $class; |
18
|
|
|
|
|
|
|
|
19
|
335
|
|
|
|
|
650
|
$self->{required} = [ List::MoreUtils::uniq $self->_build_required ]; |
20
|
|
|
|
|
|
|
|
21
|
335
|
|
|
|
|
899
|
return $self; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub _build_required { |
25
|
335
|
|
|
335
|
|
482
|
my ($self) = @_; |
26
|
|
|
|
|
|
|
|
27
|
335
|
|
|
|
|
933
|
return grep defined, $self->{this}; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub dep { |
31
|
282
|
|
|
282
|
0
|
13614
|
my ($self) = @_; |
32
|
282
|
|
|
|
|
1356
|
return $self->{dep}; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub required { |
36
|
98
|
|
|
98
|
0
|
29966
|
my ($self) = @_; |
37
|
|
|
|
|
|
|
|
38
|
98
|
|
|
|
|
123
|
return @{ $self->{required} }; |
|
98
|
|
|
|
|
320
|
|
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub unresolved { |
42
|
14
|
|
|
14
|
0
|
21152
|
my ($self, $resolved) = @_; |
43
|
14
|
|
|
|
|
41
|
my $default = $self->{default}; |
44
|
14
|
|
50
|
|
|
91
|
$resolved //= {}; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
return |
47
|
|
|
|
|
|
|
grep ! exists $default->{$_}, |
48
|
14
|
|
|
|
|
42
|
grep ! exists $resolved->{$_}, |
49
|
|
|
|
|
|
|
$self->required |
50
|
|
|
|
|
|
|
; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub default { |
54
|
74
|
|
|
74
|
0
|
3832
|
my ($self) = @_; |
55
|
|
|
|
|
|
|
|
56
|
74
|
|
|
|
|
87
|
return %{ $self->{default} }; |
|
74
|
|
|
|
|
186
|
|
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub build { |
60
|
17
|
|
|
17
|
0
|
3982
|
my ($self, $resolved) = @_; |
61
|
|
|
|
|
|
|
|
62
|
17
|
|
50
|
|
|
23
|
$resolved = { %{ $self->{default} }, %{ $resolved // {} } }; |
|
17
|
|
|
|
|
31
|
|
|
17
|
|
|
|
|
78
|
|
63
|
17
|
|
|
|
|
61
|
my @args = $self->build_callback_args ($resolved); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
return $self->{as}->(@args) |
66
|
17
|
100
|
|
|
|
91
|
if $self->{as}; |
67
|
|
|
|
|
|
|
|
68
|
2
|
|
|
|
|
4
|
my $this = shift @args; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
return $this->can ($self->{call})->(@args) |
71
|
2
|
100
|
|
|
|
14
|
if exists $self->{call}; |
72
|
|
|
|
|
|
|
|
73
|
1
|
|
|
|
|
3
|
return $this->${\ $self->{builder} } (@args); |
|
1
|
|
|
|
|
4
|
|
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub build_callback_args { |
77
|
29
|
|
|
29
|
0
|
10843
|
my ($self, $resolved) = @_; |
78
|
|
|
|
|
|
|
|
79
|
29
|
|
|
|
|
159
|
return map $resolved->{$_}, grep $_, $self->{this}; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; |
83
|
|
|
|
|
|
|
|