* add feature to disable cycle checking, eitehr via trait or option
[gitmo/MooseX-Storage.git] / lib / MooseX / Storage / Traits / DisableCycleDetection.pm
CommitLineData
5b7ea1fd 1package MooseX::Storage::Traits::DisableCycleDetection;
2use Moose::Role;
3
4our $VERSION = '0.18';
5our $AUTHORITY = 'cpan:STEVAN';
6
71;
8
9__END__
10
11=pod
12
13=head1 NAME
14
15MooseX::Storage::Traits::DisableCycleDetection - A custom trait to bypass cycle detection
16
17=head1 SYNOPSIS
18
19
20 package Double;
21 use Moose;
22 use MooseX::Storage;
23 with Storage( traits => ['DisableCycleDetection'] );
24
25 has 'x' => ( is => 'rw', isa => 'HashRef' );
26 has 'y' => ( is => 'rw', isa => 'HashRef' );
27
28 my $ref = {};
29
30 my $double = Double->new( 'x' => $ref, 'y' => $ref );
31
32 $double->pack;
33
34
35=head1 DESCRIPTION
36
37C<MooseX::Storage> implements a primitive check for circular references.
38This check also triggers on simple cases as shown in the Synopsis.
39Providing the C<DisableCycleDetection> traits disables checks for any cyclical
40references, so if you know what you are doing, you can bypass this check.
41
42This trait is applied to all objects that inherit from it. To use this
43on a per-case basis, see C<disable_cycle_check> in L<MooseX::Storage::Basic>.
44
45See the SYNOPSIS for a nice example that can be easily cargo-culted.
46
47=head1 METHODS
48
49=head2 Introspection
50
51=over 4
52
53=item B<meta>
54
55=back
56
57=head1 BUGS
58
59All complex software has bugs lurking in it, and this module is no
60exception. If you find a bug please either email me, or add the bug
61to cpan-RT.
62
63=head1 AUTHOR
64
65Stevan Little E<lt>stevan.little@iinteractive.comE<gt>
66
67=head1 COPYRIGHT AND LICENSE
68
69Copyright 2007-2008 by Infinity Interactive, Inc.
70
71L<http://www.iinteractive.com>
72
73This library is free software; you can redistribute it and/or modify
74it under the same terms as Perl itself.
75
76=cut