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