Restore InflateColumn::File functionality.
[dbsrgits/DBIx-Class-Historic.git] / lib / DBIx / Class / ResultSourceHandle.pm
index 60118b8..c1a5070 100644 (file)
@@ -7,11 +7,16 @@ use Storable;
 use base qw/DBIx::Class/;
 
 use overload
+    # on some RH perls the following line causes serious performance problem
+    # see https://bugzilla.redhat.com/show_bug.cgi?id=196836
     q/""/ => sub { __PACKAGE__ . ":" . shift->source_moniker; },
     fallback => 1;
 
 __PACKAGE__->mk_group_accessors('simple' => qw/schema source_moniker/);
 
+# Schema to use when thawing.
+our $thaw_schema;
+
 =head1 NAME
 
 DBIx::Class::ResultSourceHandle
@@ -35,7 +40,7 @@ stringify to almost nothing
 
 =item *
 
-Closer to being aboe to do a Serialize::Storable that doesn't require class-based connections
+Closer to being able to do a Serialize::Storable that doesn't require class-based connections
 
 =back
 
@@ -61,16 +66,40 @@ Resolve the moniker into the actual ResultSource object
 
 sub resolve { return $_[0]->schema->source($_[0]->source_moniker) }
 
+=head2 STORABLE_freeze
+
+Freezes a handle.
+
+=cut
+
 sub STORABLE_freeze {
     my ($self, $cloning) = @_;
+
     my $to_serialize = { %$self };
+    
     delete $to_serialize->{schema};
     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.
+
+=cut
+
+
 sub STORABLE_thaw {
     my ($self, $cloning,$ice) = @_;
     %$self = %{ Storable::thaw($ice) };
+    $self->{schema} = $thaw_schema;
 }
 
+=head1 AUTHOR
+
+Ash Berlin C<< <ash@cpan.org> >>
+
+=cut
+
 1;