Question

I have a Dancer app that is working. I am using DBIC for the database.

I want to add some tables to the database, and so I created new files for those. However, now when I restart the app, I get the following errors

Error while loading ././bin/app.pl: Could not load schema_class MyApp::Schema at /usr/local/share/perl/5.14.2/Dancer/Plugin/DBIC.pm line 42.
Compilation failed in require at ././bin/app.pl line 5.
BEGIN failed--compilation aborted at ././bin/app.pl line 5.

When I remove the new files, everything works fine.

Here is my Schema.pm file

package MyApp::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;

1;

Where can I get more information about the error and what I did wrong?

Was it helpful?

Solution

Since you are using __PACKAGE__->load_namespaces, all new classes will loaded, which explains why the simple existence of the new class files cause an error. If there is a syntax error in your new class files, then loading the schema will die.

You can use perl -c on the new class files to ensure they will compile and get a better idea of the problem if they do not.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top