# 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);
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;
" 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" );