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);
32 MooseX::Storage::Traits::DisableCycleDetection - A custom trait to bypass cycle detection
40 with Storage( traits => ['DisableCycleDetection'] );
42 has 'x' => ( is => 'rw', isa => 'HashRef' );
43 has 'y' => ( is => 'rw', isa => 'HashRef' );
47 my $double = Double->new( 'x' => $ref, 'y' => $ref );
53 C<MooseX::Storage> implements a primitive check for circular references.
54 This check also triggers on simple cases as shown in the Synopsis.
55 Providing the C<DisableCycleDetection> traits disables checks for any cyclical
56 references, so if you know what you are doing, you can bypass this check.
58 This trait is applied to all objects that inherit from it. To use this
59 on a per-case basis, see C<disable_cycle_check> in L<MooseX::Storage::Basic>.
61 See the SYNOPSIS for a nice example that can be easily cargo-culted.
75 All complex software has bugs lurking in it, and this module is no
76 exception. If you find a bug please either email me, or add the bug
81 Stevan Little E<lt>stevan.little@iinteractive.comE<gt>
83 =head1 COPYRIGHT AND LICENSE
85 Copyright 2007-2008 by Infinity Interactive, Inc.
87 L<http://www.iinteractive.com>
89 This library is free software; you can redistribute it and/or modify
90 it under the same terms as Perl itself.