line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# This package contains all classfields
|
2
|
|
|
|
|
|
|
#
|
3
|
|
|
|
|
|
|
# class, { attr => .. # calls Class::Maker::fields::attr
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Class::Maker::Basic::Fields;
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub configure
|
8
|
|
|
|
|
|
|
{
|
9
|
0
|
|
|
0
|
0
|
|
my $args = shift;
|
10
|
|
|
|
|
|
|
|
11
|
0
|
|
|
|
|
|
my $reflex = shift;
|
12
|
|
|
|
|
|
|
|
13
|
0
|
0
|
|
|
|
|
Class::Maker::_make_method( 'new', exists $args->{ctor} ? $args->{ctor} : 'new' );
|
14
|
|
|
|
|
|
|
|
15
|
0
|
0
|
|
|
|
|
if( exists $args->{explicit} )
|
16
|
|
|
|
|
|
|
{
|
17
|
0
|
|
|
|
|
|
$Class::Maker::explicit = $args->{explicit};
|
18
|
|
|
|
|
|
|
|
19
|
0
|
0
|
|
|
|
|
warn "EXPLICIT $explicit" if $DEBUG;
|
20
|
|
|
|
|
|
|
}
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# dtor is missing here
|
23
|
|
|
|
|
|
|
}
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub persistance
|
26
|
|
|
|
|
|
|
{
|
27
|
0
|
|
|
0
|
0
|
|
my $args = shift;
|
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
my $reflex = shift;
|
30
|
|
|
|
|
|
|
|
31
|
1
|
|
|
1
|
|
12
|
no strict 'refs';
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
60
|
|
32
|
|
|
|
|
|
|
}
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub isa
|
35
|
|
|
|
|
|
|
{
|
36
|
0
|
|
|
0
|
0
|
|
my $args = shift;
|
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
my $reflex = shift;
|
39
|
|
|
|
|
|
|
|
40
|
1
|
|
|
1
|
|
6
|
no strict 'refs';
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
120
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# Transform parent classes
|
43
|
|
|
|
|
|
|
#
|
44
|
|
|
|
|
|
|
# package My;
|
45
|
|
|
|
|
|
|
#
|
46
|
|
|
|
|
|
|
# .Class::Any # relative to the current package: My::Class::Any
|
47
|
|
|
|
|
|
|
#
|
48
|
|
|
|
|
|
|
# *Class::Any # relative to the current package: My::Class::Any
|
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
map { s/^[\*\.]/${Class::Maker::cpkg}::/ } @$args;
|
|
0
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
@{ "${Class::Maker::pkg}::ISA" } = @$args;
|
|
0
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
}
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub version
|
56
|
|
|
|
|
|
|
{
|
57
|
0
|
|
|
0
|
0
|
|
my $args = shift;
|
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
my $reflex = shift;
|
60
|
|
|
|
|
|
|
|
61
|
1
|
|
|
1
|
|
4
|
no strict 'refs';
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
363
|
|
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
${ "${Class::Maker::pkg}::VERSION" } = shift @$args;
|
|
0
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
}
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub can
|
67
|
0
|
|
|
0
|
0
|
|
{
|
68
|
|
|
|
|
|
|
#my $args = shift;
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
#no strict 'refs';
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
#my $varname = "${pkg}::CAN";
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
#@{ $varname } = @$args;
|
75
|
|
|
|
|
|
|
}
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub default
|
78
|
|
|
|
|
|
|
{
|
79
|
0
|
|
|
0
|
0
|
|
my $args = shift;
|
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
my $reflex = shift;
|
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
foreach my $attr ( keys %$args )
|
84
|
|
|
|
|
|
|
{
|
85
|
0
|
0
|
|
|
|
|
warn sprintf "\tpredefined default %s = '%s'\n", $attr, $args->{$attr} if $DEBUG;
|
86
|
|
|
|
|
|
|
}
|
87
|
|
|
|
|
|
|
}
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
our $protected_prefix = { public => '', protected => '__', private => '_' };
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub _create_accessor
|
92
|
|
|
|
|
|
|
{
|
93
|
0
|
|
|
0
|
|
|
my $protected = shift;
|
94
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
my $args = shift;
|
96
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
my $reflex = shift;
|
98
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
foreach my $type ( keys %$args )
|
100
|
|
|
|
|
|
|
{
|
101
|
0
|
0
|
|
|
|
|
my @attributes = ( ref( $args->{$type} ) eq 'HASH' ) ? keys %{$args->{$type}} : @{ $args->{$type} };
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
103
|
0
|
|
|
|
|
|
foreach my $name ( @attributes )
|
104
|
|
|
|
|
|
|
{
|
105
|
0
|
|
|
|
|
|
Class::Maker::_make_method( $type, $protected_prefix->{$protected}.$name );
|
106
|
|
|
|
|
|
|
}
|
107
|
|
|
|
|
|
|
}
|
108
|
|
|
|
|
|
|
}
|
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub public
|
111
|
|
|
|
|
|
|
{
|
112
|
0
|
|
|
0
|
0
|
|
_create_accessor( 'public', @_ );
|
113
|
|
|
|
|
|
|
}
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub private
|
116
|
|
|
|
|
|
|
{
|
117
|
0
|
|
|
0
|
0
|
|
_create_accessor( 'private', @_ );
|
118
|
|
|
|
|
|
|
}
|
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub protected
|
121
|
|
|
|
|
|
|
{
|
122
|
0
|
|
|
0
|
0
|
|
_create_accessor( 'protected', @_ );
|
123
|
|
|
|
|
|
|
}
|
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub has
|
126
|
|
|
|
|
|
|
{
|
127
|
0
|
|
|
0
|
0
|
|
my $args = shift;
|
128
|
|
|
|
|
|
|
|
129
|
0
|
|
|
|
|
|
my $reflex = shift;
|
130
|
|
|
|
|
|
|
|
131
|
0
|
|
|
|
|
|
foreach ( keys %$args )
|
132
|
|
|
|
|
|
|
{
|
133
|
0
|
0
|
|
|
|
|
warn "\tkey: $_\n" if $DEBUG;
|
134
|
|
|
|
|
|
|
}
|
135
|
|
|
|
|
|
|
}
|
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
1;
|