line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
32
|
|
|
32
|
|
174
|
use strict; |
|
32
|
|
|
|
|
55
|
|
|
32
|
|
|
|
|
1192
|
|
2
|
32
|
|
|
32
|
|
171
|
use warnings; |
|
32
|
|
|
|
|
71
|
|
|
32
|
|
|
|
|
1180
|
|
3
|
|
|
|
|
|
|
|
4
|
32
|
|
|
32
|
|
168
|
use Carp qw(croak); |
|
32
|
|
|
|
|
57
|
|
|
32
|
|
|
|
|
1691
|
|
5
|
|
|
|
|
|
|
|
6
|
32
|
|
|
32
|
|
185
|
use VS::RuleEngine::Engine::Common; |
|
32
|
|
|
|
|
69
|
|
|
32
|
|
|
|
|
759
|
|
7
|
32
|
|
|
32
|
|
163
|
use VS::RuleEngine::TypeDecl; |
|
32
|
|
|
|
|
79
|
|
|
32
|
|
|
|
|
13435
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub add_hook { |
10
|
54
|
|
|
54
|
1
|
9909
|
my ($self, $name, $hook, $defaults, @args) = @_; |
11
|
54
|
|
|
|
|
226
|
$self->_check_add_args('Hook', \&has_hook, $name, $hook); |
12
|
46
|
|
|
|
|
1101
|
$self->_hooks->set($name => VS::RuleEngine::TypeDecl->new($hook, $defaults, @args)); |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub hooks { |
16
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
17
|
0
|
|
|
|
|
0
|
return $self->_hooks->keys; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub has_hook { |
21
|
145
|
|
|
145
|
1
|
2825
|
my ($self, $name) = @_; |
22
|
145
|
|
|
|
|
3689
|
return $self->_hooks->exists($name); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _get_hook { |
26
|
39
|
|
|
39
|
|
66
|
my ($self, $name) = @_; |
27
|
|
|
|
|
|
|
|
28
|
39
|
50
|
|
|
|
308
|
if ($self->has_hook($name)) { |
29
|
39
|
|
|
|
|
888
|
return $self->_hooks->get($name); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
else { |
32
|
0
|
|
|
|
|
0
|
croak "Can't find hook '$name'"; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub add_pre_hook { |
37
|
14
|
|
|
14
|
1
|
51
|
my ($self, $name) = @_; |
38
|
|
|
|
|
|
|
|
39
|
14
|
50
|
|
|
|
36
|
if ($self->has_hook($name)) { |
40
|
14
|
|
|
|
|
21
|
push @{$self->_pre_hooks}, $name; |
|
14
|
|
|
|
|
315
|
|
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
else { |
43
|
0
|
|
|
|
|
0
|
croak "Can't add hook '$name' because it does not exist"; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub add_post_hook { |
48
|
31
|
|
|
31
|
1
|
62
|
my ($self, $name) = @_; |
49
|
|
|
|
|
|
|
|
50
|
31
|
50
|
|
|
|
69
|
if ($self->has_hook($name)) { |
51
|
31
|
|
|
|
|
121
|
push @{$self->_post_hooks}, $name; |
|
31
|
|
|
|
|
763
|
|
52
|
31
|
|
|
|
|
189
|
return; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
else { |
55
|
0
|
|
|
|
|
|
croak "Can't add hook '$name' because it does not exist"; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
__END__ |