* add feature to disable cycle checking, eitehr via trait or option
[gitmo/MooseX-Storage.git] / lib / MooseX / Storage / Traits / DisableCycleDetection.pm
1 package MooseX::Storage::Traits::DisableCycleDetection;
2 use Moose::Role;
3
4 our $VERSION   = '0.18';
5 our $AUTHORITY = 'cpan:STEVAN';
6
7 1;
8
9 __END__
10
11 =pod
12
13 =head1 NAME
14
15 MooseX::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
37 C<MooseX::Storage> implements a primitive check for circular references.
38 This check also triggers on simple cases as shown in the Synopsis.
39 Providing the C<DisableCycleDetection> traits disables checks for any cyclical
40 references, so if you know what you are doing, you can bypass this check.
41
42 This trait is applied to all objects that inherit from it. To use this
43 on a per-case basis, see C<disable_cycle_check> in L<MooseX::Storage::Basic>.
44
45 See 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
59 All complex software has bugs lurking in it, and this module is no 
60 exception. If you find a bug please either email me, or add the bug
61 to cpan-RT.
62
63 =head1 AUTHOR
64
65 Stevan Little E<lt>stevan.little@iinteractive.comE<gt>
66
67 =head1 COPYRIGHT AND LICENSE
68
69 Copyright 2007-2008 by Infinity Interactive, Inc.
70
71 L<http://www.iinteractive.com>
72
73 This library is free software; you can redistribute it and/or modify
74 it under the same terms as Perl itself.
75
76 =cut