line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package KiokuDB::Reference; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
1
|
|
|
1
|
|
29572
|
$KiokuDB::Reference::AUTHORITY = 'cpan:NUFFIN'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
$KiokuDB::Reference::VERSION = '0.57'; |
6
|
1
|
|
|
1
|
|
1593
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# ABSTRACT: A symbolic reference to another KiokuDB::Entry. |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use namespace::clean -except => 'meta'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
with qw(MooseX::Clone); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has id => ( |
14
|
|
|
|
|
|
|
isa => "Str", |
15
|
|
|
|
|
|
|
is => "rw", |
16
|
|
|
|
|
|
|
required => 1, |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
has is_weak => ( |
20
|
|
|
|
|
|
|
isa => "Bool", |
21
|
|
|
|
|
|
|
is => "rw", |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub STORABLE_freeze { |
25
|
|
|
|
|
|
|
my ( $self, $cloning ) = @_; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
join(",", $self->id, !!$self->is_weak); # FIXME broken |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub STORABLE_thaw { |
32
|
|
|
|
|
|
|
my ( $self, $cloning, $serialized ) = @_; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my ( $id, $weak ) = ( $serialized =~ /^(.*?),(1?)$/ ); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
$self->id($id); |
37
|
|
|
|
|
|
|
$self->is_weak(1) if $weak; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
return $self; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__PACKAGE__ |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=pod |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=encoding UTF-8 |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 NAME |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
KiokuDB::Reference - A symbolic reference to another KiokuDB::Entry. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 VERSION |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
version 0.57 |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 SYNOPSIS |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
my $ref = KiokuDB::Reference->new( |
63
|
|
|
|
|
|
|
id => $some_id, |
64
|
|
|
|
|
|
|
); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 DESCRIPTION |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
This object serves as an internal marker to point to entries by UID. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
The linker resolves these references by searching the live object set and |
71
|
|
|
|
|
|
|
loading entries from the backend as necessary. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=over 4 |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item id |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
The ID this entry refers to |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=item is_weak |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
This reference is weak. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=back |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 AUTHOR |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Yuval Kogman <nothingmuch@woobling.org> |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
This software is copyright (c) 2014 by Yuval Kogman, Infinity Interactive. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
96
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut |