DBIx::Class::Schema::Loader: can't load schemaby jds17 (Pilgrim)
|on Dec 03, 2012 at 20:52 UTC||Need Help??|
jds17 has asked for the
wisdom of the Perl Monks concerning the following question:
Update / Bug found!
I found the reason why the module could not be loaded. Before the call to the method make_schema_at of DBIx::Class::Schema::Loader, @INC contained the current directory '.'. After the call, though, this entry has disappeared from @INC. Would you consider this as a bug or am I too reckless assuming @INC would not be touched?
Dear Perl Monks,
as I am trying to get something to work using DBIx::Class::Schema::Loader , I keep bumping my head against some issues. The first is the following:
I have an SQLite database on disk and want to dump its DBIx::Class schema and connect to the schema immediately afterwards. The test code is as follows:
If I run this (passing appropriate connection parameters), I get the following error:
Now, if I put the call to make_schema_at in a separate script and call it as follows:
everything works fine. Or, if I run the original script two times, the first time after having added an exit() after the call to make_schema_at and the second time after having commented out the call to make_schema_at, everything runs fine, too.
I ran the program in a debugger and put a breakpoint immediately after the call to make_schema_at, made a backup of the resulting schema dump and compared it to the result one gets when exiting after having dumped it. There is no difference, i.e. it was not the case that something has not been written to disk yet.
Please enlighten my troubled brain: Why does dump_and_import_schema not work as expected?
Update: Improved readability of title and first sentence.