I am using Catalyst::Plugin::AutoCRUD and am generating a DBIx schema using the instructions provided in the linked CPAN page. Specifically, I copy/pasted the command listed there and changed only the details relevant to my database ('pg' => 'mysql', different username/pw, etc).
I now have a schema DBIC::Database::foo::Schema. Schema is both a file containing *.pm's for each table in my DB and also it's own Schema.pm.
My config file contains the following entry:
<Model::AutoCRUD::DBIC>
schema_class Database::foo::Schema
connect_info dbi:mysql:dbname=foo
connect_info user
connect_info pass
<connect_info>
AutoCommit 1
</connect_info>
</Model::AutoCRUD::DBIC>
When I go to start the AutoCRUD server, I get the following error message:
Couldn't instantiate component "DemoApp::Model::AutoCRUD::DBIC", "Attribute (schema_class)
does not pass the type constraint because: Validation failed for
'Catalyst::Model::DBIC::Schema::Types::SchemaClass' with value Database::foo::Schema at
/Library/Perl/5.12/darwin-thread-multi-2level/Moose/Meta/Attribute.pm line 1275.
As I am new to Catalyst and this plugin, I don't know how to resolve this issue. Google has not been very helpful - I found this discussion, but from what I can tell the issue was that Catalyst was being pointed towards the wrong *.pm (although I could be misreading this).
In case this is helpful, here are the contents of Schema.pm:
use utf8;
package DBIC::Database::foo::Schema;
# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE
use strict;
use warnings;
use base 'DBIx::Class::Schema';
__PACKAGE__->load_namespaces;
# Created by DBIx::Class::Schema::Loader v0.07024 @ 2012-05-20 07:25:21
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:cevz/k4rUWIcEhMl29r0QA
# You can replace this text with custom code or comments, and it will be preserved on regeneration
1;
Please help!
Completely rebuilding the DBIC classes from the Catalyst manual solved the problem. While I cannot pinpoint what was unacceptable to Moose in the first set of classes, the second set of classes had one additional problem: the line __PACKAGE__->meta->make_immutable;
was generated for every class (i.e. in each *.pm). Commenting it out and restarting Catalyst yielded a functioning CRUD app.