X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FResultSet.pm;h=46ac2d1cea787949a9a588d2d4a7ddde6803bdee;hb=0b66414bdc046f0980221e3ef3cfb6945814824a;hp=25344b7f2714c78a1cc67d05bbcc3279a4c69c47;hpb=26148d36e66d7f7c67863cea8d6501739b765692;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index 25344b7..46ac2d1 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -12,6 +12,7 @@ use DBIx::Class::ResultSourceHandle; use List::Util (); use Scalar::Util qw/blessed weaken/; use Try::Tiny; +use Storable qw/nfreeze thaw/; use namespace::clean; use overload @@ -3309,6 +3310,7 @@ sub _merge_attr { return $orig; } + sub result_source { my $self = shift; @@ -3319,6 +3321,27 @@ sub result_source { } } + +sub STORABLE_freeze { + my ($self, $cloning) = @_; + my $to_serialize = { %$self }; + + # A cursor in progress can't be serialized (and would make little sense anyway) + delete $to_serialize->{cursor}; + + return nfreeze($to_serialize); +} + +# need this hook for symmetry +sub STORABLE_thaw { + my ($self, $cloning, $serialized) = @_; + + %$self = %{ thaw($serialized) }; + + return $self; +} + + =head2 throw_exception See L for details.