Commit | Line | Data |
a473d69d |
1 | package MooseX::Storage::Engine::Trait::DisableCycleDetection; |
2 | use Moose::Role; |
3 | |
3513de05 |
4 | around 'check_for_cycle_in_collapse' => sub { |
5 | my ($orig, $self, $attr, $value) = @_; |
6 | # See NOTE in MX::Storage::Engine |
7 | return $value; |
8 | }; |
9 | |
a473d69d |
10 | 1; |
11 | |
511f9c4b |
12 | =head1 NAME |
13 | |
14 | MooseX::Storage::Engine::Trait::DisableCycleDetection - A custom trait to bypass cycle detection |
15 | |
16 | =head1 SYNOPSIS |
17 | |
18 | package Double; |
19 | use Moose; |
20 | use MooseX::Storage; |
21 | with Storage( traits => ['DisableCycleDetection'] ); |
22 | |
23 | has 'x' => ( is => 'rw', isa => 'HashRef' ); |
24 | has 'y' => ( is => 'rw', isa => 'HashRef' ); |
25 | |
26 | my $ref = {}; |
27 | |
28 | my $double = Double->new( 'x' => $ref, 'y' => $ref ); |
29 | |
30 | $double->pack; |
31 | |
32 | =head1 DESCRIPTION |
33 | |
34 | C<MooseX::Storage> implements a primitive check for circular references. |
35 | This check also triggers on simple cases as shown in the Synopsis. |
36 | Providing the C<DisableCycleDetection> traits disables checks for any cyclical |
37 | references, so if you know what you are doing, you can bypass this check. |
38 | |
39 | This trait is applied to an instance of L<MooseX::Storage::Engine>, for the |
40 | user-visible version shown in the SYNOPSIS, see L<MooseX::Storage::Traits::DisableCycleDetection> |
41 | |
42 | =head1 METHODS |
43 | |
44 | =head2 Introspection |
45 | |
46 | =over 4 |
47 | |
48 | =item B<meta> |
49 | |
50 | =back |
51 | |
52 | =head1 BUGS |
53 | |
54 | All complex software has bugs lurking in it, and this module is no |
55 | exception. If you find a bug please either email me, or add the bug |
56 | to cpan-RT. |
57 | |
58 | =head1 AUTHOR |
59 | |
60 | Stevan Little E<lt>stevan.little@iinteractive.comE<gt> |
61 | |
62 | =head1 COPYRIGHT AND LICENSE |
63 | |
64 | Copyright 2007-2008 by Infinity Interactive, Inc. |
65 | |
66 | L<http://www.iinteractive.com> |
67 | |
68 | This library is free software; you can redistribute it and/or modify |
69 | it under the same terms as Perl itself. |
70 | |
71 | =cut |
72 | |