line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Class::Frame; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
19673
|
use 5.006; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
39
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
5
|
1
|
|
|
1
|
|
5
|
no strict 'refs'; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
24
|
|
6
|
1
|
|
|
1
|
|
4
|
no strict 'subs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
7
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
98
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '1.0'; |
10
|
|
|
|
|
|
|
our ( @ISA, @EXPORT ); |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
5
|
use Exporter; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
487
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
@ISA = qw( Exporter ); |
15
|
|
|
|
|
|
|
@EXPORT = qw( DEFINE_FIELDS ); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub DEFINE_FIELDS { |
18
|
3
|
|
|
3
|
0
|
31
|
my $pkg = (caller())[0]; |
19
|
3
|
|
|
|
|
17
|
my %args = @_; |
20
|
|
|
|
|
|
|
|
21
|
3
|
|
|
10
|
|
15
|
*{$pkg.'::_FIELDS'} = sub {return {%args}}; |
|
3
|
|
|
|
|
25
|
|
|
10
|
|
|
|
|
155
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# Inject constructor |
24
|
3
|
|
|
|
|
5
|
my $constructor =<<'CONSTRUCTOR'; |
25
|
|
|
|
|
|
|
sub { |
26
|
|
|
|
|
|
|
my $pkg = shift; |
27
|
|
|
|
|
|
|
my %args = @_; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my $self = {}; |
30
|
|
|
|
|
|
|
bless $self, $pkg; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# Set-up class fields with default values |
33
|
|
|
|
|
|
|
my $fields = $self->_FIELDS; |
34
|
|
|
|
|
|
|
$self->_setter(name => $_, val => $fields->{$_}) |
35
|
|
|
|
|
|
|
for (keys %$fields); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# Update class fields with new values |
38
|
|
|
|
|
|
|
$self->_setter(name => $_, val => $args{$_}) for (keys %args); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
return $self; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
CONSTRUCTOR |
43
|
|
|
|
|
|
|
|
44
|
3
|
|
|
1
|
|
568
|
*{$pkg.'::new'} = eval($constructor); |
|
3
|
|
|
|
|
19
|
|
|
1
|
|
|
|
|
25
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
53
|
|
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
23
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
14
|
|
|
2
|
|
|
|
|
24
|
|
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
29
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
5
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# Inject accessors/mutators |
47
|
3
|
|
|
|
|
13
|
foreach my $arg (keys %args) { |
48
|
|
|
|
|
|
|
|
49
|
9
|
|
|
1
|
|
676
|
*{$pkg.'::set_'.$arg} = |
|
9
|
|
|
|
|
86
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
4
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
28
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
22
|
|
|
1
|
|
|
|
|
4
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
22
|
|
|
1
|
|
|
|
|
4
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
3
|
|
50
|
|
|
|
|
|
|
eval('sub { my $self = shift; $self->_setter(name => "'.$arg.'", val => shift);}'); |
51
|
|
|
|
|
|
|
|
52
|
9
|
|
|
0
|
|
657
|
*{$pkg.'::get_'.$arg} = |
|
9
|
|
|
|
|
63
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
17
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
11
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
3
|
|
|
|
|
31
|
|
|
3
|
|
|
|
|
20
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
53
|
|
|
|
|
|
|
eval('sub { my $self = shift; return $self->_getter(name => "'.$arg.'");}'); |
54
|
|
|
|
|
|
|
|
55
|
9
|
|
|
0
|
|
707
|
*{$pkg.'::get_'.$arg.'_default'} = |
|
9
|
|
|
|
|
53
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
26
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6
|
|
56
|
|
|
|
|
|
|
eval('sub { my $self = shift; return $self->_FIELDS->{'.$arg.'};}'); |
57
|
|
|
|
|
|
|
|
58
|
9
|
|
|
|
|
15
|
*{$pkg.'::'.$arg} = *{$pkg.'::get_'.$arg}; |
|
9
|
|
|
|
|
70
|
|
|
9
|
|
|
|
|
26
|
|
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub _setter { |
63
|
19
|
|
|
19
|
|
30
|
my $self = shift; |
64
|
19
|
|
|
|
|
45
|
my %args = @_; |
65
|
19
|
50
|
|
|
|
49
|
my $name = $args{name} or die "name argument is missing"; |
66
|
19
|
|
|
|
|
379
|
$self->{$name} = $args{val}; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub _getter { |
70
|
10
|
|
|
10
|
|
14
|
my $self = shift; |
71
|
10
|
|
|
|
|
21
|
my %args = @_; |
72
|
10
|
50
|
|
|
|
33
|
my $name = $args{name} or die "name argument is missing"; |
73
|
10
|
|
|
|
|
59
|
return $self->{$name}; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
1; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
__END__ |