line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MooseX::Storage::Traits::DisableCycleDetection; |
2
|
|
|
|
|
|
|
# ABSTRACT: A custom trait to bypass cycle detection |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.52'; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
729
|
use Moose::Role; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
10
|
|
7
|
1
|
|
|
1
|
|
4100
|
use namespace::autoclean; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
8
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
requires 'pack'; |
10
|
|
|
|
|
|
|
requires 'unpack'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
around 'pack' => sub { |
13
|
|
|
|
|
|
|
my ($orig, $self, %args) = @_; |
14
|
|
|
|
|
|
|
$args{engine_traits} ||= []; |
15
|
|
|
|
|
|
|
push(@{$args{engine_traits}}, 'DisableCycleDetection'); |
16
|
|
|
|
|
|
|
$self->$orig(%args); |
17
|
|
|
|
|
|
|
}; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
around 'unpack' => sub { |
20
|
|
|
|
|
|
|
my ($orig, $self, $data, %args) = @_; |
21
|
|
|
|
|
|
|
$args{engine_traits} ||= []; |
22
|
|
|
|
|
|
|
push(@{$args{engine_traits}}, 'DisableCycleDetection'); |
23
|
|
|
|
|
|
|
$self->$orig($data, %args); |
24
|
|
|
|
|
|
|
}; |
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
1
|
|
183
|
no Moose::Role; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
__END__ |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=pod |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=encoding UTF-8 |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 NAME |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
MooseX::Storage::Traits::DisableCycleDetection - A custom trait to bypass cycle detection |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 VERSION |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
version 0.52 |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 SYNOPSIS |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
package Double; |
47
|
|
|
|
|
|
|
use Moose; |
48
|
|
|
|
|
|
|
use MooseX::Storage; |
49
|
|
|
|
|
|
|
with Storage( traits => ['DisableCycleDetection'] ); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
has 'x' => ( is => 'rw', isa => 'HashRef' ); |
52
|
|
|
|
|
|
|
has 'y' => ( is => 'rw', isa => 'HashRef' ); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
my $ref = {}; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
my $double = Double->new( 'x' => $ref, 'y' => $ref ); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
$double->pack; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 DESCRIPTION |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
C<MooseX::Storage> implements a primitive check for circular references. |
63
|
|
|
|
|
|
|
This check also triggers on simple cases as shown in the Synopsis. |
64
|
|
|
|
|
|
|
Providing the C<DisableCycleDetection> traits disables checks for any cyclical |
65
|
|
|
|
|
|
|
references, so if you know what you are doing, you can bypass this check. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
This trait is applied to all objects that inherit from it. To use this |
68
|
|
|
|
|
|
|
on a per-case basis, see C<disable_cycle_check> in L<MooseX::Storage::Basic>. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=for stopwords culted |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
See the SYNOPSIS for a nice example that can be easily cargo-culted. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 SUPPORT |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-Storage> |
77
|
|
|
|
|
|
|
(or L<bug-MooseX-Storage@rt.cpan.org|mailto:bug-MooseX-Storage@rt.cpan.org>). |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
There is also a mailing list available for users of this distribution, at |
80
|
|
|
|
|
|
|
L<http://lists.perl.org/list/moose.html>. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
There is also an irc channel available for users of this distribution, at |
83
|
|
|
|
|
|
|
L<C<#moose> on C<irc.perl.org>|irc://irc.perl.org/#moose>. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 AUTHORS |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=over 4 |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=item * |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Chris Prather <chris.prather@iinteractive.com> |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=item * |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Stevan Little <stevan.little@iinteractive.com> |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=item * |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
×××× ×§××'×× (Yuval Kogman) <nothingmuch@woobling.org> |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=back |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
This software is copyright (c) 2007 by Infinity Interactive, Inc. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
108
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=cut |