line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package KiokuDB::Thunk; |
4
|
22
|
|
|
22
|
|
185
|
use Moose; |
|
22
|
|
|
|
|
33
|
|
|
22
|
|
|
|
|
140
|
|
5
|
|
|
|
|
|
|
|
6
|
22
|
|
|
22
|
|
101905
|
use namespace::clean -except => 'meta'; |
|
22
|
|
|
|
|
46
|
|
|
22
|
|
|
|
|
202
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has collapsed => ( |
9
|
|
|
|
|
|
|
isa => "Ref", |
10
|
|
|
|
|
|
|
is => "ro", |
11
|
|
|
|
|
|
|
required => 1, |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has linker => ( |
15
|
|
|
|
|
|
|
isa => "KiokuDB::Linker", |
16
|
|
|
|
|
|
|
is => "ro", |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
has attr => ( |
20
|
|
|
|
|
|
|
isa => "Class::MOP::Attribute", |
21
|
|
|
|
|
|
|
is => "ro", |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has value => ( |
25
|
|
|
|
|
|
|
isa => "Ref", |
26
|
|
|
|
|
|
|
is => "ro", |
27
|
|
|
|
|
|
|
lazy_build => 1, |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub _build_value { |
31
|
0
|
|
|
0
|
|
|
my $self = shift; |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
return $self->linker->expand_object($self->collapsed); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub vivify { |
37
|
0
|
|
|
0
|
0
|
|
my ( $self, $instance ) = @_; |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
my $value = $self->value; |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
my $attr = $self->attr; |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
$attr->set_raw_value($instance, $value); |
44
|
|
|
|
|
|
|
|
45
|
0
|
0
|
0
|
|
|
|
$attr->_weaken_value($instance) |
46
|
|
|
|
|
|
|
if ref $value and $attr->is_weak_ref; |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
return $value; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
__PACKAGE__ |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=pod |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 NAME |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
KiokuDB::Thunk - Internal only placeholder for deferred objects |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 SYNOPSIS |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# do not use directly, |
66
|
|
|
|
|
|
|
# KiokuDB::Meta::Attribute::Lazy, KiokuDB::Meta::Instance and |
67
|
|
|
|
|
|
|
# KiokuDB::TypeMap::Entry::MOP will do the actual thunking of data so that |
68
|
|
|
|
|
|
|
# the thunk will never be visible unless you break encapsulation. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 DESCRIPTION |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
This is an internal placeholder object. It will be used on attributes that you |
73
|
|
|
|
|
|
|
mark with L<KiokuDB::Meta::Attribute::Lazy> automatically, and should never be |
74
|
|
|
|
|
|
|
visible to the user because L<KiokuDB::Meta::Instance> will automatically |
75
|
|
|
|
|
|
|
inflate it before it's even seen by the accessor's code. |
76
|
|
|
|
|
|
|
|