Ok, so, the interface just changed, and the docs are complete crap now, but the imple...
t0m [Wed, 24 Jun 2009 21:36:53 +0000 (22:36 +0100)]
lib/MooseX/Storage/Engine.pm
lib/MooseX/Storage/Engine/Trait/DisableCycleDetection.pm
t/004_w_cycles.t

index 7df03a1..729f6d9 100644 (file)
@@ -78,13 +78,8 @@ sub collapse_attribute_value {
        # this might not be enough, we might
        # need to make it possible for the
        # cycle checker to return the value
-       # Check cycles unless explicitly disabled
-    if( ref $value and not(
-        $options->{disable_cycle_check} or
-        $self->object->does('MooseX::Storage::Traits::DisableCycleDetection')
-    )) {        
-        $self->check_for_cycle_in_collapse($attr, $value)
-    }
+    $self->check_for_cycle_in_collapse($attr, $value)
+        if ref $value;
 
     if (defined $value && $attr->has_type_constraint) {
         my $type_converter = $self->find_type_handler($attr->type_constraint);
index 717e243..b0ab38c 100644 (file)
@@ -1,5 +1,11 @@
 package MooseX::Storage::Engine::Trait::DisableCycleDetection;
 use Moose::Role;
 
+around 'check_for_cycle_in_collapse' => sub {
+    my ($orig, $self, $attr, $value) = @_;
+    # See NOTE in MX::Storage::Engine
+    return $value;
+};
+
 1;
 
index 12a4ca8..f7e60c1 100644 (file)
@@ -155,7 +155,7 @@ This test demonstrates two things:
                                 "   And unpacked again" );
     }
     
-    my $pack = $double->pack( disable_cycle_check => 1 );
+    my $pack = $double->pack( engine_traits => [qw/DisableCycleDetection/] );
     ok( $pack,                  "   Object packs when cycle check is disabled");
     ok( Double->unpack( $pack ),
                                 "   And unpacked again" );