From: Matt S Trout Date: Fri, 9 Dec 2005 02:41:03 +0000 (+0000) Subject: Lo, doth everything now use resultset_instance X-Git-Tag: v0.05005~119^2~29 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3c0068c1b295fc61b9af96da469c9f3e2471f503;p=dbsrgits%2FDBIx-Class.git Lo, doth everything now use resultset_instance --- diff --git a/Build.PL b/Build.PL index 6061e4d..da41963 100644 --- a/Build.PL +++ b/Build.PL @@ -17,6 +17,7 @@ my %arguments = ( 'Tie::IxHash' => 0, 'Module::Find' => 0, 'Storable' => 0, + 'Class::Data::Accessor' => 0.01, # Following for CDBICompat only 'Class::Trigger' => 0, 'DBIx::ContextualFetch' => 0, diff --git a/lib/DBIx/Class.pm b/lib/DBIx/Class.pm index 4e1c8e8..e2deaf5 100644 --- a/lib/DBIx/Class.pm +++ b/lib/DBIx/Class.pm @@ -4,7 +4,9 @@ use strict; use warnings; use vars qw($VERSION); -use base qw/DBIx::Class::Componentised Class::Data::Inheritable/; +use base qw/DBIx::Class::Componentised Class::Data::Accessor/; + +sub mk_classdata { shift->mk_classaccessor(@_); } $VERSION = '0.0499_01'; diff --git a/lib/DBIx/Class/Core.pm b/lib/DBIx/Class/Core.pm index 7c3a1af..99c4b2a 100644 --- a/lib/DBIx/Class/Core.pm +++ b/lib/DBIx/Class/Core.pm @@ -9,10 +9,10 @@ use base qw/DBIx::Class/; __PACKAGE__->load_components(qw/ InflateColumn Relationship - ResultSetInstance PK Row Table + ResultSetInstance Exception AccessorGroup/); diff --git a/lib/DBIx/Class/ResultSetInstance.pm b/lib/DBIx/Class/ResultSetInstance.pm index 4b83c42..022ca20 100644 --- a/lib/DBIx/Class/ResultSetInstance.pm +++ b/lib/DBIx/Class/ResultSetInstance.pm @@ -2,9 +2,11 @@ package DBIx::Class::ResultSetInstance; use base qw/DBIx::Class/; -sub search { shift->resultset->search(@_); } -sub search_literal { shift->resultset->search_literal(@_); } -sub count { shift->resultset->count(@_); } -sub count_literal { shift->resultset->count_literal(@_); } +sub search { shift->resultset_instance->search(@_); } +sub search_literal { shift->resultset_instance->search_literal(@_); } +sub count { shift->resultset_instance->count(@_); } +sub count_literal { shift->resultset_instance->count_literal(@_); } + +__PACKAGE__->mk_classdata('resultset_instance'); 1; diff --git a/lib/DBIx/Class/Table.pm b/lib/DBIx/Class/Table.pm index 97d8fef..e322a0c 100644 --- a/lib/DBIx/Class/Table.pm +++ b/lib/DBIx/Class/Table.pm @@ -62,12 +62,16 @@ sub add_columns { $class->_mk_column_accessors(@cols); } -sub resultset { +sub resultset_instance { my $class = shift; + $class->next::method($class->construct_resultset); +} +sub construct_resultset { + my $class = shift; my $rs_class = $class->_resultset_class; eval "use $rs_class;"; - my $rs = $rs_class->new($class, @_); + return $rs_class->new($class); } =item search_like diff --git a/t/cdbi-t/12-filter.t b/t/cdbi-t/12-filter.t index ecaff02..adab754 100644 --- a/t/cdbi-t/12-filter.t +++ b/t/cdbi-t/12-filter.t @@ -158,6 +158,7 @@ sub slice { qw/fred barney/ } package main; Actor->iterator_class('Class::DBI::My::Iterator'); +Actor->resultset_instance(Actor->construct_resultset); { my @acts = $film->actors->slice(1, 2);