1 package MooseX::Storage::Traits::DisableCycleDetection;
5 our $AUTHORITY = 'cpan:STEVAN';
10 around 'pack' => sub {
11 my ($orig, $self, %args) = @_;
12 $args{engine_traits} ||= [];
13 push(@{$args{engine_traits}}, 'DisableCycleDetection');
17 around 'unpack' => sub {
18 my ($orig, $self, $data, %args) = @_;
19 $args{engine_traits} ||= [];
20 push(@{$args{engine_traits}}, 'DisableCycleDetection');
21 $self->$orig($data, %args);
34 MooseX::Storage::Traits::DisableCycleDetection - A custom trait to bypass cycle detection
42 with Storage( traits => ['DisableCycleDetection'] );
44 has 'x' => ( is => 'rw', isa => 'HashRef' );
45 has 'y' => ( is => 'rw', isa => 'HashRef' );
49 my $double = Double->new( 'x' => $ref, 'y' => $ref );
55 C<MooseX::Storage> implements a primitive check for circular references.
56 This check also triggers on simple cases as shown in the Synopsis.
57 Providing the C<DisableCycleDetection> traits disables checks for any cyclical
58 references, so if you know what you are doing, you can bypass this check.
60 This trait is applied to all objects that inherit from it. To use this
61 on a per-case basis, see C<disable_cycle_check> in L<MooseX::Storage::Basic>.
63 See the SYNOPSIS for a nice example that can be easily cargo-culted.
77 All complex software has bugs lurking in it, and this module is no
78 exception. If you find a bug please either email me, or add the bug
83 Stevan Little E<lt>stevan.little@iinteractive.comE<gt>
85 =head1 COPYRIGHT AND LICENSE
87 Copyright 2007-2008 by Infinity Interactive, Inc.
89 L<http://www.iinteractive.com>
91 This library is free software; you can redistribute it and/or modify
92 it under the same terms as Perl itself.