line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MooX::InsideOut::Role::GenerateAccessor; |
2
|
1
|
|
|
1
|
|
1890
|
use Hash::Util::FieldHash::Compat qw(fieldhash); |
|
1
|
|
|
|
|
188593
|
|
|
1
|
|
|
|
|
6
|
|
3
|
1
|
|
|
1
|
|
103
|
use Sub::Quote qw(quotify); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
56
|
|
4
|
1
|
|
|
1
|
|
5
|
use Moo::Role; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
12
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
fieldhash our %FIELDS; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
around generate_method => sub { |
9
|
|
|
|
|
|
|
my $orig = shift; |
10
|
|
|
|
|
|
|
my $self = shift; |
11
|
|
|
|
|
|
|
# would like a better way to disable XS |
12
|
|
|
|
|
|
|
local $Method::Generate::Accessor::CAN_HAZ_XS = 0; |
13
|
|
|
|
|
|
|
#TODO: add Storable hooks |
14
|
|
|
|
|
|
|
$self->$orig(@_); |
15
|
|
|
|
|
|
|
}; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub _generate_simple_get { |
18
|
14
|
|
|
14
|
|
205
|
my ($self, $me, $name) = @_; |
19
|
14
|
|
|
|
|
124
|
my $name_str = quotify $name; |
20
|
14
|
|
|
|
|
135
|
$self->{captures}{'$MooX_InsideOut_FIELDS'} = \\%FIELDS; |
21
|
14
|
|
|
|
|
82
|
"\$MooX_InsideOut_FIELDS->{${me}}->{${name_str}}"; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub _generate_simple_has { |
25
|
1
|
|
|
1
|
|
892
|
my ($self, $me, $name) = @_; |
26
|
1
|
|
|
|
|
5
|
"exists " . $self->_generate_simple_get($me, $name); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub _generate_simple_clear { |
30
|
1
|
|
|
1
|
|
614
|
my ($self, $me, $name) = @_; |
31
|
1
|
|
|
|
|
6
|
"delete " . $self->_generate_simple_get($me, $name); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub _generate_core_set { |
35
|
8
|
|
|
8
|
|
3020
|
my ($self, $me, $name, $spec, $value) = @_; |
36
|
8
|
|
|
|
|
22
|
$self->_generate_simple_get($me, $name) . " = ${value}"; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub _generate_xs { |
40
|
0
|
|
|
0
|
|
0
|
die "Can't generate XS accessors for inside out objects"; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
2
|
|
|
2
|
0
|
2803
|
sub default_construction_string { '\(my $s)' } |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |