1 package DBIx::Class::ResultSourceHandle;
7 use base qw/DBIx::Class/;
10 # on some RH perls the following line causes serious performance problem
11 # see https://bugzilla.redhat.com/show_bug.cgi?id=196836
12 q/""/ => sub { __PACKAGE__ . ":" . shift->source_moniker; },
15 __PACKAGE__->mk_group_accessors('simple' => qw/schema source_moniker/);
17 # Schema to use when thawing.
22 DBIx::Class::ResultSourceHandle
26 This module removes fixed link between Rows/ResultSets and the actual source
27 objects, which gets round the following problems
33 Needing to keep C<$schema> in scope, since any objects/result_sets
34 will have a C<$schema> object through their source handle
38 Large output when using Data::Dump(er) since this class can be set to
39 stringify to almost nothing
43 Closer to being able to do a Serialize::Storable that doesn't require class-based connections
54 my ($class, $data) = @_;
56 $class = ref $class if ref $class;
63 Resolve the moniker into the actual ResultSource object
67 sub resolve { return $_[0]->schema->source($_[0]->source_moniker) }
69 =head2 STORABLE_freeze
76 my ($self, $cloning) = @_;
78 my $to_serialize = { %$self };
80 delete $to_serialize->{schema};
81 return (Storable::freeze($to_serialize));
86 Thaws frozen handle. Resets the internal schema reference to the package
87 variable C<$thaw_schema>. The recomened way of setting this is to use
88 C<$schema->thaw($ice)> which handles this for you.
94 my ($self, $cloning,$ice) = @_;
95 %$self = %{ Storable::thaw($ice) };
96 $self->{schema} = $thaw_schema;
101 Ash Berlin C<< <ash@cpan.org> >>