1 package DBIx::Class::Serialize::Storable;
6 my ($self,$cloning) = @_;
7 my $to_serialize = { %$self };
8 delete $to_serialize->{result_source};
9 return (Storable::freeze($to_serialize));
13 my ($self,$cloning,$serialized) = @_;
14 %$self = %{ Storable::thaw($serialized) };
15 $self->result_source($self->result_source_instance)
16 if $self->can('result_source_instance');
25 DBIx::Class::Serialize::Storable - hooks for Storable freeze/thaw
30 # in a table class definition
31 __PACKAGE__->load_components(qw/Serialize::Storable/);
33 # meanwhile, in a nearby piece of code
34 my $cd = $schema->resultset('CD')->find(12);
35 $cache->set($cd->ID, $cd); # if the cache uses Storable, this
36 # will work automatically
40 This component adds hooks for Storable so that row objects can be
41 serialized. It assumes that your row object class (C<result_class>) is
42 the same as your table class, which is the normal situation. However,
43 this code is not yet well tested, and so should be considered
48 David Kamholz <dkamholz@cpan.org>
52 You may distribute this code under the same terms as Perl itself.