- move attribute recording to DBIx::Class
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Serialize.pm
CommitLineData
ed28f830 1package DBIx::Class::Serialize;
2use strict;
3use Storable qw/freeze thaw/;
4
5sub STORABLE_freeze {
6 my ($self,$cloning) = @_;
7 return if $cloning;
8 my $to_serialize = { %$self };
9 delete $to_serialize->{result_source};
10 return (freeze($to_serialize));
11}
12
13sub STORABLE_thaw {
14 my ($self,$cloning,$serialized) = @_;
15 %$self = %{ thaw($serialized) };
16 no strict 'refs';
17 my $class = ${(ref $self) . '::ISA'}[0];
18 my $schema = DB->schema;
19 $self->result_source($schema->source($class));
20}
21
221;