line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
32
|
|
|
32
|
|
161
|
use strict; |
|
32
|
|
|
|
|
54
|
|
|
32
|
|
|
|
|
1230
|
|
2
|
32
|
|
|
32
|
|
218
|
use warnings; |
|
32
|
|
|
|
|
54
|
|
|
32
|
|
|
|
|
991
|
|
3
|
|
|
|
|
|
|
|
4
|
32
|
|
|
32
|
|
154
|
use Carp qw(croak); |
|
32
|
|
|
|
|
55
|
|
|
32
|
|
|
|
|
1446
|
|
5
|
|
|
|
|
|
|
|
6
|
32
|
|
|
32
|
|
192
|
use VS::RuleEngine::Engine::Common; |
|
32
|
|
|
|
|
55
|
|
|
32
|
|
|
|
|
812
|
|
7
|
32
|
|
|
32
|
|
213
|
use VS::RuleEngine::TypeDecl; |
|
32
|
|
|
|
|
68
|
|
|
32
|
|
|
|
|
15024
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub add_rule { |
10
|
67
|
|
|
67
|
1
|
18449
|
my ($self, $name, $rule, $defaults, @args) = @_; |
11
|
67
|
|
|
|
|
254
|
$self->_check_add_args('Rule', \&has_rule, $name, $rule); |
12
|
58
|
|
|
|
|
1314
|
$self->_rules->set($name => VS::RuleEngine::TypeDecl->new($rule, $defaults, @args)); |
13
|
58
|
|
|
|
|
1340
|
$self->_rule_actions->set($name => []); |
14
|
58
|
|
|
|
|
83
|
push @{$self->_rule_order}, $name; |
|
58
|
|
|
|
|
1433
|
|
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub add_rule_action { |
18
|
49
|
|
|
49
|
1
|
156
|
my ($self, $name, $action) = @_; |
19
|
|
|
|
|
|
|
|
20
|
49
|
|
|
|
|
114
|
my $actions = $self->_get_rule_actions($name); |
21
|
48
|
|
|
|
|
301
|
push @$actions, $action; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub rules { |
25
|
1
|
|
|
1
|
1
|
1037
|
my $self = shift; |
26
|
1
|
|
|
|
|
36
|
return $self->_rules->keys; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub has_rule { |
30
|
264
|
|
|
264
|
1
|
1039
|
my ($self, $name) = @_; |
31
|
264
|
|
|
|
|
6244
|
return $self->_rules->exists($name); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub _get_rule { |
35
|
54
|
|
|
54
|
|
1210
|
my ($self, $name) = @_; |
36
|
|
|
|
|
|
|
|
37
|
54
|
100
|
|
|
|
331
|
if ($self->has_rule($name)) { |
38
|
53
|
|
|
|
|
1136
|
return $self->_rules->get($name); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
1
|
|
|
|
|
15
|
croak "Rule '${name}' does not exist"; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub _get_rule_actions { |
45
|
99
|
|
|
99
|
|
136
|
my ($self, $name) = @_; |
46
|
|
|
|
|
|
|
|
47
|
99
|
100
|
|
|
|
177
|
if ($self->has_rule($name)) { |
48
|
98
|
|
|
|
|
2140
|
return $self->_rule_actions->get($name); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
1
|
|
|
|
|
25
|
croak "Rule '${name}' does not exist"; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub set_rule_order { |
55
|
1
|
|
|
1
|
1
|
1032
|
my ($self, @order) = @_; |
56
|
|
|
|
|
|
|
|
57
|
1
|
|
|
|
|
4
|
$self->{_rule_order} = \@order; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub rule_order { |
61
|
2
|
|
|
2
|
1
|
13
|
my $self = shift; |
62
|
2
|
|
|
|
|
3
|
return @{$self->_rule_order}; |
|
2
|
|
|
|
|
44
|
|
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |
66
|
|
|
|
|
|
|
__END__ |