File Coverage

blib/lib/VS/RuleEngine/Engine/Actions.pm
Criterion Covered Total %
statement 26 26 100.0
branch 2 2 100.0
condition n/a
subroutine 9 9 100.0
pod 3 3 100.0
total 40 40 100.0


line stmt bran cond sub pod time code
1 32     32   175 use strict;
  32         59  
  32         1550  
2 32     32   166 use warnings;
  32         63  
  32         913  
3              
4 32     32   162 use Carp qw(croak);
  32         63  
  32         1811  
5              
6 32     32   18749 use VS::RuleEngine::Engine::Common;
  32         88  
  32         858  
7 32     32   19524 use VS::RuleEngine::TypeDecl;
  32         362  
  32         7310  
8              
9             sub add_action {
10 66     66 1 11937 my ($self, $name, $action, $defaults, @args) = @_;
11 66         254 $self->_check_add_args('Action', \&has_action, $name, $action);
12 57         1281 $self->_actions->set($name => VS::RuleEngine::TypeDecl->new($action, $defaults, @args));
13             }
14              
15             sub actions {
16 35     35 1 60 my $self = shift;
17 35         812 return $self->_actions->keys;
18             }
19              
20             sub has_action {
21 167     167 1 5059 my ($self, $name) = @_;
22 167         4074 return $self->_actions->exists($name);
23             }
24              
25             sub _get_action {
26 53     53   517 my ($self, $name) = @_;
27              
28 53 100       127 if ($self->has_action($name)) {
29 52         1094 return $self->_actions->get($name);
30             }
31              
32 1         11 croak "Can't find action '$name'";
33             }
34              
35             1;
36             __END__