[Catalyst] DBIC connecting to remote MySQL

Robert Wohlfarth rbwohlfarth at gmail.com
Sun May 23 12:50:07 GMT 2010


On Sun, May 23, 2010 at 6:38 AM, Dan <dan at entropy.homelinux.org> wrote:

> __PACKAGE__->config(
>    schema_class =3D> 'EasySaver',
>
>    connect_info =3D> {
>        dsn =3D> 'dbi:mysql:dbname=3DEasySaver;host=3Darcheopteryx',
>        user =3D> 'username',
>        password =3D> 'password',
>        AutoCommit =3D> q{1},
>    }
> );
>
> [snip...]

> Couldn't load class (EasySaver) because: Couldn't instantiate component
> "EasySaver::Model::ESDB", "Attribute (schema_class) does not pass the
> type constraint because: Validation failed for
> 'Catalyst::Model::DBIC::Schema::Types::SchemaClass' failed with value
> EasySaver
> at
> /usr/lib/perl5/site_perl/5.10.1/i686-linux-thread-multi/Moose/Meta/Attrib=
ute.pm
> line 746
>

You may want to try a different "schema_class". When you generated the
model, it should also have created a "Schema.pm" file. Put that package name
(not file name, the package name) in "schema_class". At least, this is what
worked in my setup.

I say that because of the error message. The first paragraph of output
contains the actual error message. The rest of that is a stack trace that
you don't need for this issue.

Catalyst uses something called
"Moose<http://search.cpan.org/dist/Moose/lib/Moose/Manual.pod>".
Moose adds shortcuts for quickly building object oriented packages. It's
very cool stuff. Moose offers limited type checking. Moose reported a
mis-match in the type it expected versus the type it received.

"schema_class" eventually becomes an object attribute. Moose thinks that
"schema_class" should be set to an instance of type
"Catalyst::Model::DBIC::Schema::Types::SchemaClass". The "EasySchema" from
the configuration file is not from the Catalyst::Model::DBIC hierarchy.

-- =

Robert Wohlfarth
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20100523/544f7=
602/attachment.htm


More information about the Catalyst mailing list