locked_user sundialsvc4 has asked for the wisdom of the Perl Monks concerning the following question:
Okay, let me start over on this post... :-)
The code looks like this:
my $schema = My::Schema::Class->connect ("dbi:mysql:dbname=BLAHBLAH;host=localhost", "BLAH", "HEAPBIGSECRET", {AutoCommit => 1}) or croak("cannot connect to main database"); # Strobe the database-connection right now to be sure it's here $schema->storage->ensure_connected(); croak("connection failed to main database") unless $schema->storage->connected;
So far so good... but now, in my test-script...
lives_ok { require My::Schema::Class::TFoodtype} "required OK"; lives_ok { My::Schema::Class->load_classes(qw/TFoodtype/) } "loaded one again"; isa_ok($s->schema->resultset('TFoodtype'), "DBIx::Class::ResultSet");
And this is what fails:my @records; lives_ok { @records = $s->schema ->resultset('TFoodtype') ->search({foodtype=>'YUM'})->all() } "searched okay";
This is what it says:
Can't call method "select" on an undefined value at (..blah..)/5.8.8/DBIx/Class/ResultSet.pm line 514.
Now, if you study the test-script closely (it uses Test::More and Test::Except ...), you will see that I am trying to systematically check everything I can think of. I know, by this point, that the connection is present. I know that the class is loaded. I know that the resultset('TFoodtype') call is returning a result-set. So it comes down to the final call... and I know that I am doing something abjectly stupid here and I just can't see it!
(Whimper...) My hand is poised, ready to slap my forehead...
Replies are listed 'Best First'. | |
---|---|
Re: DBIx::Class "Can't call method 'select' on an undefined value"
by Your Mother (Archbishop) on Jan 22, 2009 at 01:06 UTC | |
Re: DBIx::Class "Can't call method 'select' on an undefined value"
by locked_user sundialsvc4 (Abbot) on Jan 22, 2009 at 01:07 UTC | |
Re: DBIx::Class "Can't call method 'select' on an undefined value"
by locked_user sundialsvc4 (Abbot) on Jan 22, 2009 at 01:57 UTC | |
by dragonchild (Archbishop) on Jan 23, 2009 at 03:57 UTC | |
Re: DBIx::Class "Can't call method 'select' on an undefined value"
by jasonk (Parson) on Jan 22, 2009 at 02:31 UTC |