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