delete $to_serialize->{related_resultsets};
delete $to_serialize->{_inflated_column};
- return('', $to_serialize);
+ return (Storable::freeze($to_serialize));
}
sub STORABLE_thaw {
- my ($self, $cloning, $junk, $obj) = @_;
+ my ($self, $cloning, $serialized) = @_;
- %$self = %{ $obj };
+ %$self = %{ Storable::thaw($serialized) };
$self->result_source($self->result_source_instance)
if $self->can('result_source_instance');
}
my $schema = DBICTest->init_schema();
my %stores = (
- dclone => sub { return dclone($_[0]) },
- "freeze/thaw" => sub { return thaw(freeze($_[0])) },
+ dclone_method => sub { return $schema->dclone($_[0]) },
+ "freeze/thaw_method" => sub {
+ my $ice = $schema->freeze($_[0]);
+ return $schema->thaw($ice);
+ },
);
plan tests => (7 * keys %stores);
qq[serialize with related_resultset "$key"]);
}
- ok eval { $copy->discard_changes; 1 };
+ ok eval { $copy->discard_changes; 1 } or diag $@;
is($copy->id, $artist->id, "IDs still match ");
}