1 package MooseX::Storage::Traits::DisableCycleDetection;
8 my ($orig, $self, %args) = @_;
9 $args{engine_traits} ||= [];
10 push(@{$args{engine_traits}}, 'DisableCycleDetection');
14 around 'unpack' => sub {
15 my ($orig, $self, $data, %args) = @_;
16 $args{engine_traits} ||= [];
17 push(@{$args{engine_traits}}, 'DisableCycleDetection');
18 $self->$orig($data, %args);
31 MooseX::Storage::Traits::DisableCycleDetection - A custom trait to bypass cycle detection
39 with Storage( traits => ['DisableCycleDetection'] );
41 has 'x' => ( is => 'rw', isa => 'HashRef' );
42 has 'y' => ( is => 'rw', isa => 'HashRef' );
46 my $double = Double->new( 'x' => $ref, 'y' => $ref );
52 C<MooseX::Storage> implements a primitive check for circular references.
53 This check also triggers on simple cases as shown in the Synopsis.
54 Providing the C<DisableCycleDetection> traits disables checks for any cyclical
55 references, so if you know what you are doing, you can bypass this check.
57 This trait is applied to all objects that inherit from it. To use this
58 on a per-case basis, see C<disable_cycle_check> in L<MooseX::Storage::Basic>.
60 See the SYNOPSIS for a nice example that can be easily cargo-culted.
74 All complex software has bugs lurking in it, and this module is no
75 exception. If you find a bug please either email me, or add the bug
80 Stevan Little E<lt>stevan.little@iinteractive.comE<gt>
82 =head1 COPYRIGHT AND LICENSE
84 Copyright 2007-2008 by Infinity Interactive, Inc.
86 L<http://www.iinteractive.com>
88 This library is free software; you can redistribute it and/or modify
89 it under the same terms as Perl itself.