Subject: | DBIx::Class doesn't ensure the class is loaded when you specify cursor_class in your connection info. |
If I specify a connection like this with a cursor class,
my $schema = SchemaClass->connect(
$dsn, $user, $pass, { cursor_class => 'DBIx::Class::Cursor::Cached'
}
);
If I don't have the class loaded in my schema then when I come to use it
I get a complaint that the class isn't loaded.
t/zzzzzzz_cursor_load.t .. Can't locate object method "new" via package
"DBIx::Class::Cursor::Cached" (perhaps you forgot to load
"DBIx::Class::Cursor::Cached"?) at /home/colin/git/DBIx-
Class/lib/DBIx/Class/Storage/DBI.pm line 2171.
I've created half a test (attached). In order to make the test work
(apart from making cursor_class load the class) you'd need to include a
local copy of DBIx::Class::Cursor::Cached in t/lib.
Subject: | zzzzzzz_cursor_load.t |
use strict;
use warnings;
use Test::More;
use lib qw(t/lib);
use DBICTest;
my $schema = DBICTest->init_schema(cursor_class => 'DBIx::Class::Cursor::Cached');
my @art = $schema->resultset("Artist")->search({ }, { order_by => 'name DESC'});
is(@art, 3, "Three artists returned");
done_testing;