I'm trying to learn how to use the database plugins, specifically DBIx. I set up my schemas to load from an existing database (hopefully), and now I want to test it out to see if I did that right. So I put the following lines into a page called dbixdemo.pm, in the "default" function:

        my $schema = VieSEB::Schema::SLogDB->new();
        my $crazy_attempt = $schema->resultset('SLogDB')->find(14);

The server script compiles and runs it fine, which is a good sign. But when I try to view the page in a browser, I get this error message:

Caught exception in vieSEB::Controller::dbixdemo->default "Can't locate object method "new" via package "VieSEB::Schema::SLogDB" (perhaps you forgot to load "VieSEB::Schema::SLogDB"?)

I've searched the mailing list archives, but I'm afraid I can't figure out how to debug this. Can anyone offer some suggestions? My schemas are below.

Thanks in advance,

Sarah



Here are the schemas I set up:
In the Model folder, SLogDB.pm:

package VieSEB::Model::SLogDB;

use warnings;
use strict;

use base 'Catalyst::Model::DBIC::Schema';

__PACKAGE__->config(
schema_class => 'VieSEB::Model::SLogDB',
);

return 1;


In the Schema folder, I have an empty folder named SLogDB/ , and a file called SLogDB.pm:

package VieSEB::Schema::SLogDB;

use warnings;
use strict;

use base qw/DBIx::Class::Schema::Loader/;

__PACKAGE__->load_from_connection(
connect_info =  [
'databaseInfo',
'username',
'password',
{AutoCommit => 1}
]
);

my $dsn = 'databaseInfo';
my $user = 'username';
my $password = 'password',
my $options = {AutoCommit => 1};

1;


(where of course databaseInfo, username, and password are the actual values)
_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to