line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Method::Generate::ClassAccessor; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
17277
|
use 5.008; |
|
5
|
|
|
|
|
16
|
|
|
5
|
|
|
|
|
198
|
|
4
|
5
|
|
|
5
|
|
27
|
use strict; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
179
|
|
5
|
5
|
|
|
5
|
|
27
|
use warnings; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
199
|
|
6
|
5
|
|
|
5
|
|
23
|
no warnings qw( void once uninitialized numeric ); |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
268
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
BEGIN { |
9
|
5
|
|
|
5
|
|
24
|
no warnings 'once'; |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
197
|
|
10
|
5
|
|
|
5
|
|
9
|
$Method::Generate::ClassAccessor::AUTHORITY = 'cpan:TOBYINK'; |
11
|
5
|
|
|
|
|
93
|
$Method::Generate::ClassAccessor::VERSION = '0.011'; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
5
|
|
|
5
|
|
26
|
use B 'perlstring'; |
|
5
|
|
|
|
|
16
|
|
|
5
|
|
|
|
|
414
|
|
15
|
|
|
|
|
|
|
|
16
|
5
|
|
|
5
|
|
29
|
use base qw(Method::Generate::Accessor); |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
2577
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub generate_method |
19
|
|
|
|
|
|
|
{ |
20
|
8
|
|
|
8
|
1
|
1332
|
my ($self, $into, $name, $spec, $quote_opts) = @_; |
21
|
8
|
|
|
|
|
14
|
local $Method::Generate::Accessor::CAN_HAZ_XS = 0; # sorry |
22
|
8
|
|
33
|
|
|
46
|
$spec->{_classy} ||= $into; |
23
|
8
|
|
|
|
|
50
|
my $r = $self->SUPER::generate_method($into, $name, $spec, $quote_opts); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# Populate default value |
26
|
8
|
50
|
|
|
|
796
|
unless ($spec->{lazy}) |
27
|
|
|
|
|
|
|
{ |
28
|
8
|
|
|
|
|
13
|
my $storage = do { |
29
|
5
|
|
|
5
|
|
50536
|
no strict 'refs'; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
1676
|
|
30
|
8
|
|
|
|
|
10
|
\%{"$spec->{_classy}\::__ClassAttributeValues"}; |
|
8
|
|
|
|
|
44
|
|
31
|
|
|
|
|
|
|
}; |
32
|
|
|
|
|
|
|
|
33
|
8
|
|
|
|
|
9
|
my $default; |
34
|
8
|
100
|
|
|
|
120
|
if (ref($default = $spec->{default})) |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
35
|
|
|
|
|
|
|
{ |
36
|
2
|
|
|
|
|
6
|
$storage->{$name} = $default->($into); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
elsif ($default = $spec->{default}) |
39
|
|
|
|
|
|
|
{ |
40
|
1
|
|
|
|
|
3
|
$storage->{$name} = $default; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
elsif ($default = $spec->{builder}) |
43
|
|
|
|
|
|
|
{ |
44
|
0
|
|
|
|
|
0
|
$storage->{$name} = $into->$default; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
8
|
|
|
|
|
41
|
return $r; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub _generate_simple_get |
52
|
|
|
|
|
|
|
{ |
53
|
10
|
|
|
10
|
|
495
|
my ($self, $me, $name, $spec) = @_; |
54
|
10
|
|
|
|
|
24
|
my $classy = $spec->{_classy}; |
55
|
10
|
|
|
|
|
33
|
"\$$classy\::__ClassAttributeValues{${\perlstring $name}}"; |
|
10
|
|
|
|
|
58
|
|
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub _generate_core_set |
59
|
|
|
|
|
|
|
{ |
60
|
9
|
|
|
9
|
|
894
|
my ($self, $me, $name, $spec, $value) = @_; |
61
|
9
|
|
|
|
|
17
|
my $classy = $spec->{_classy}; |
62
|
9
|
|
|
|
|
18
|
"\$$classy\::__ClassAttributeValues{${\perlstring $name}} = $value"; |
|
9
|
|
|
|
|
42
|
|
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub _generate_simple_has |
66
|
|
|
|
|
|
|
{ |
67
|
2
|
|
|
2
|
|
127
|
my ($self, $me, $name, $spec) = @_; |
68
|
2
|
|
|
|
|
4
|
my $classy = $spec->{_classy}; |
69
|
2
|
|
|
|
|
6
|
"exists \$$classy\::__ClassAttributeValues{${\perlstring $name}}"; |
|
2
|
|
|
|
|
22
|
|
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub _generate_simple_clear |
73
|
|
|
|
|
|
|
{ |
74
|
1
|
|
|
1
|
|
99
|
my ($self, $me, $name, $spec) = @_; |
75
|
1
|
|
|
|
|
3
|
my $classy = $spec->{_classy}; |
76
|
1
|
|
|
|
|
3
|
"delete \$$classy\::__ClassAttributeValues{${\perlstring $name}}"; |
|
1
|
|
|
|
|
9
|
|
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__END__ |