Lo, doth everything now use resultset_instance
Matt S Trout [Fri, 9 Dec 2005 02:41:03 +0000 (02:41 +0000)]
Build.PL
lib/DBIx/Class.pm
lib/DBIx/Class/Core.pm
lib/DBIx/Class/ResultSetInstance.pm
lib/DBIx/Class/Table.pm
t/cdbi-t/12-filter.t

index 6061e4d..da41963 100644 (file)
--- 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,
index 4e1c8e8..e2deaf5 100644 (file)
@@ -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';
 
index 7c3a1af..99c4b2a 100644 (file)
@@ -9,10 +9,10 @@ use base qw/DBIx::Class/;
 __PACKAGE__->load_components(qw/
   InflateColumn
   Relationship
-  ResultSetInstance
   PK
   Row
   Table
+  ResultSetInstance
   Exception
   AccessorGroup/);
 
index 4b83c42..022ca20 100644 (file)
@@ -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;
index 97d8fef..e322a0c 100644 (file)
@@ -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
index ecaff02..adab754 100644 (file)
@@ -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);