line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package VS::RuleEngine::TypeDecl; |
2
|
|
|
|
|
|
|
|
3
|
32
|
|
|
32
|
|
38581
|
use strict; |
|
32
|
|
|
|
|
61
|
|
|
32
|
|
|
|
|
1133
|
|
4
|
32
|
|
|
32
|
|
200
|
use warnings; |
|
32
|
|
|
|
|
63
|
|
|
32
|
|
|
|
|
910
|
|
5
|
|
|
|
|
|
|
|
6
|
32
|
|
|
32
|
|
169
|
use Carp qw(croak); |
|
32
|
|
|
|
|
66
|
|
|
32
|
|
|
|
|
2388
|
|
7
|
32
|
|
|
32
|
|
208
|
use Scalar::Util qw(blessed); |
|
32
|
|
|
|
|
61
|
|
|
32
|
|
|
|
|
17868
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
229
|
|
|
229
|
1
|
1951
|
my ($pkg, $type, $defaults, @args) = @_; |
11
|
229
|
100
|
|
|
|
580
|
$defaults = [] if !defined $defaults; |
12
|
229
|
100
|
|
|
|
634
|
$defaults = [$defaults] if ref $defaults ne 'ARRAY'; |
13
|
229
|
|
|
|
|
808
|
my $self = bless [$type, $defaults, \@args], $pkg; |
14
|
229
|
|
|
|
|
993
|
return $self; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub instantiate { |
18
|
184
|
|
|
184
|
1
|
1080
|
my ($self, $engine) = @_; |
19
|
184
|
|
|
|
|
199
|
my $instance; |
20
|
|
|
|
|
|
|
|
21
|
184
|
100
|
|
|
|
347
|
if (blessed $self->_pkg) { |
22
|
1
|
|
|
|
|
3
|
$instance = $self->_pkg; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
else { |
25
|
183
|
|
|
|
|
318
|
my %defaults = map { %{$engine->get_defaults($_)} } @{$self->_defaults}; |
|
7
|
|
|
|
|
9
|
|
|
7
|
|
|
|
|
30
|
|
|
183
|
|
|
|
|
344
|
|
26
|
183
|
|
|
|
|
338
|
$instance = $self->_pkg->new(%defaults, @{$self->_args}); |
|
183
|
|
|
|
|
463
|
|
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
184
|
|
|
|
|
3624
|
return $instance; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub _pkg { |
33
|
394
|
|
|
394
|
|
14298
|
my $self = shift; |
34
|
394
|
|
|
|
|
1130
|
return $self->[0]; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub _defaults { |
38
|
183
|
|
|
183
|
|
197
|
my $self = shift; |
39
|
183
|
|
|
|
|
452
|
return $self->[1]; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub _args { |
43
|
201
|
|
|
201
|
|
258
|
my $self = shift; |
44
|
201
|
|
|
|
|
1058
|
return $self->[2]; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
__END__ |