From: David Kamholz Date: Wed, 8 Feb 2006 16:53:02 +0000 (+0000) Subject: remove ResultSource::Table::Cached X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8534b5522061f5223ed4662bee82c994428251ec;p=dbsrgits%2FDBIx-Class-Historic.git remove ResultSource::Table::Cached --- diff --git a/lib/DBIx/Class/ResultSource/Table/Cached.pm b/lib/DBIx/Class/ResultSource/Table/Cached.pm deleted file mode 100644 index 4b43a69..0000000 --- a/lib/DBIx/Class/ResultSource/Table/Cached.pm +++ /dev/null @@ -1,46 +0,0 @@ -package DBIx::Class::ResultSource::Table::Cached; - -use Scalar::Util qw/weaken/; - -use base qw/DBIx::Class/; -__PACKAGE__->load_components(qw/ResultSource::Table/); - -sub resultset { - my $self = shift; - return $self->{_resultset} ||= do { - my $rs = $self->next::method; - weaken $rs->result_source; - $rs; - }; -} - -1; - -__END__ - -=head1 NAME - -DBIx::Class::ResultSource::Table::Cached - Table object that caches its own resultset - -=head1 SYNOPSIS - - # in a table class or base of table classes (_before_ you call ->table) - __PACKAGE__->table_class('DBIx::Class::ResultSource::Table::Cached'); - -=head1 DESCRIPTION - -This is a modified version of L that caches -its resultset, so when you call $schema->resultset('Foo') it does not -re-instantiate the resultset each time. In pathological cases this may not -work correctly, e.g. if you change important attributes of the result source -object. - -=head1 AUTHORS - -David Kamholz - -=head1 LICENSE - -You may distribute this code under the same terms as Perl itself. - -=cut