File Coverage

blib/lib/MooseX/Storage/Engine/Trait/DisableCycleDetection.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 8 8 100.0


line stmt bran cond sub pod time code
1             package MooseX::Storage::Engine::Trait::DisableCycleDetection;
2             # ABSTRACT: A custom trait to bypass cycle detection
3              
4             our $VERSION = '0.53';
5              
6 1     1   3121 use Moose::Role;
  1         2  
  1         8  
7 1     1   4422 use namespace::autoclean;
  1         3  
  1         7  
8              
9             around 'check_for_cycle_in_collapse' => sub {
10             my ($orig, $self, $attr, $value) = @_;
11             # See NOTE in MX::Storage::Engine
12             return $value;
13             };
14              
15             1;
16              
17             __END__
18              
19             =pod
20              
21             =encoding UTF-8
22              
23             =head1 NAME
24              
25             MooseX::Storage::Engine::Trait::DisableCycleDetection - A custom trait to bypass cycle detection
26              
27             =head1 VERSION
28              
29             version 0.53
30              
31             =head1 SYNOPSIS
32              
33             package Double;
34             use Moose;
35             use MooseX::Storage;
36             with Storage( traits => ['DisableCycleDetection'] );
37              
38             has 'x' => ( is => 'rw', isa => 'HashRef' );
39             has 'y' => ( is => 'rw', isa => 'HashRef' );
40              
41             my $ref = {};
42              
43             my $double = Double->new( 'x' => $ref, 'y' => $ref );
44              
45             $double->pack;
46              
47             =head1 DESCRIPTION
48              
49             C<MooseX::Storage> implements a primitive check for circular references.
50             This check also triggers on simple cases as shown in the Synopsis.
51             Providing the C<DisableCycleDetection> traits disables checks for any cyclical
52             references, so if you know what you are doing, you can bypass this check.
53              
54             This trait is applied to an instance of L<MooseX::Storage::Engine>, for the
55             user-visible version shown in the SYNOPSIS, see L<MooseX::Storage::Traits::DisableCycleDetection>
56              
57             =head1 SUPPORT
58              
59             Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-Storage>
60             (or L<bug-MooseX-Storage@rt.cpan.org|mailto:bug-MooseX-Storage@rt.cpan.org>).
61              
62             There is also a mailing list available for users of this distribution, at
63             L<http://lists.perl.org/list/moose.html>.
64              
65             There is also an irc channel available for users of this distribution, at
66             L<C<#moose> on C<irc.perl.org>|irc://irc.perl.org/#moose>.
67              
68             =head1 AUTHORS
69              
70             =over 4
71              
72             =item *
73              
74             Chris Prather <chris.prather@iinteractive.com>
75              
76             =item *
77              
78             Stevan Little <stevan.little@iinteractive.com>
79              
80             =item *
81              
82             יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>
83              
84             =back
85              
86             =head1 COPYRIGHT AND LICENSE
87              
88             This software is copyright (c) 2007 by Infinity Interactive, Inc.
89              
90             This is free software; you can redistribute it and/or modify it under
91             the same terms as the Perl 5 programming language system itself.
92              
93             =cut