X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FResultSourceHandle.pm;h=cd5c45c209b96123929a7618ddb0ef1f777e1cbf;hb=48580715af3072905f2c71dc27e7f70f21a11338;hp=6d6353f88a7574154b4f0976f901882aa305b4bb;hpb=b24d86a1fbeb89083bc2eeeeb286d590ffea702a;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/ResultSourceHandle.pm b/lib/DBIx/Class/ResultSourceHandle.pm index 6d6353f..cd5c45c 100644 --- a/lib/DBIx/Class/ResultSourceHandle.pm +++ b/lib/DBIx/Class/ResultSourceHandle.pm @@ -77,26 +77,27 @@ sub STORABLE_freeze { my ($self, $cloning) = @_; my $to_serialize = { %$self }; - - my $class = $self->schema->class($self->source_moniker); - $to_serialize->{schema} = $class; + + delete $to_serialize->{schema}; + $to_serialize->{_frozen_from_class} = $self->schema->class($self->source_moniker); + return (Storable::freeze($to_serialize)); } =head2 STORABLE_thaw Thaws frozen handle. Resets the internal schema reference to the package -variable C<$thaw_schema>. The recomened way of setting this is to use -C<$schema->thaw($ice)> which handles this for you. +variable C<$thaw_schema>. The recommended way of setting this is to use +C<< $schema->thaw($ice) >> which handles this for you. =cut sub STORABLE_thaw { - my ($self, $cloning,$ice) = @_; + my ($self, $cloning, $ice) = @_; %$self = %{ Storable::thaw($ice) }; - my $class = delete $self->{schema}; + my $class = delete $self->{_frozen_from_class}; if( $thaw_schema ) { $self->{schema} = $thaw_schema; } @@ -105,7 +106,8 @@ sub STORABLE_thaw { $self->{schema} = $rs->schema if $rs; } - carp "Unable to restore schema" unless $self->{schema}; + carp "Unable to restore schema. Look at 'freeze' and 'thaw' methods in DBIx::Class::Schema." + unless $self->{schema}; } =head1 AUTHOR