Skip Menu |

This queue is for tickets about the DBIx-Class-Schema-Loader CPAN distribution.

Report information
The Basics
Id: 59849
Status: resolved
Priority: 0/
Queue: DBIx-Class-Schema-Loader

People
Owner: Nobody in particular
Requestors: MARKLE [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.07001
Fixed in: (no value)



I am using the use_namespaces option. It used to be that I have inflate/deflate and additional methods defined in packages which get merged with the dynamic packages. That is broken by the latest version. Now I get errors like this: Cannot connect schema: 'Failed to reload class DeSpam::DC::Service: Subroutine get_despam_service redefined at /tmp/dbicZT5e/DeSpam/DC/Service.pm line 213.
0.7.0 is broken too, but in that version, the error is: Cannot connect schema: 'Can't call method "Indent" without a package or object reference at /usr/lib/perl5/site_perl/5.8.8/DBIx/Class/Schema/Loader/Base.pm line 1747. BTW I am using perl 5.8.8 in CentOS.
I have to go back to 0.05003 to make it work.
BTW it doesn't matter if I rename the method in the defined package under the namespace to something else. Any method name fails. setting debug_1 shows everything working okay, then # Loaded external class definition for 'DeSpam::DC::Service' (and 3 other external class definition libs) ... and then the error when my test script tries to get the schema ... Cannot connect schema: 'Failed to reload class DeSpam::DC::Service: Subroutine get_despam_service redefined at /tmp/dbic4VsY/DeSpam/DC/Service.pm line 213.
Subject: Re: [rt.cpan.org #59849]
Date: Fri, 30 Jul 2010 11:15:18 -0400
To: Mark Hedges via RT <bug-DBIx-Class-Schema-Loader [...] rt.cpan.org>
From: Rafael Kitover <rkitover [...] cpan.org>
By the way, are you using something that fatalizes warnings? On Thu, Jul 29, 2010 at 11:25:09PM -0400, Mark Hedges via RT wrote: Show quoted text
> Queue: DBIx-Class-Schema-Loader > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=59849 > > > BTW it doesn't matter if I rename the method in the defined package > under the namespace to something else. Any method name fails. > > setting debug_1 shows everything working okay, then > > # Loaded external class definition for 'DeSpam::DC::Service' > (and 3 other external class definition libs) > > ... and then the error when my test script tries to get the schema ... > > Cannot connect schema: 'Failed to reload class DeSpam::DC::Service: > Subroutine get_despam_service redefined at > /tmp/dbic4VsY/DeSpam/DC/Service.pm line 213. >
RT-Send-CC: rkitover [...] cpan.org
On Thu Jul 29 23:25:06 2010, MARKLE wrote: ... Show quoted text
> Cannot connect schema: 'Failed to reload class DeSpam::DC::Service: > Subroutine get_despam_service redefined at > /tmp/dbic4VsY/DeSpam/DC/Service.pm line 213.
Please send me a test app that reproduces this exception.
RT-Send-CC: rkitover [...] cpan.org
On Wed Aug 04 22:02:25 2010, RKITOVER wrote: Show quoted text
> Please send me a test app that reproduces this exception.
Here is a test script with some libs to drop into the 0.07001 source directory. Am I doing something totally wrong? This used to work. Thanks. Mark
Subject: DBICTestMethods_files.tar
Download DBICTestMethods_files.tar
application/x-tar 20k

Message body not shown because it is not plain text.

I'm not sure what's going on... this does the same thing when run in 0.04006 also... but my production code works fine under 0.04006 but generates the same error as the test script in later versions. Madness. However, the test script I supplied seems simple enough as a starting point. Does it work for you? Maybe it is something else majorly screwy. This is CentOS with perl 5.8.8. Thanks.
RT-Send-CC: rkitover [...] cpan.org
This is suddenly a LOT better with an upgrade of DBIx::Class to the latest version. Looks like you need to depend on a more recent version, which is probably what you used to develop your changes since you took over. I'm still having some confusion over which namespace the result classes should get, but this might be my misunderstanding. Thanks. --mark--
Subject: Re: [rt.cpan.org #59849]
Date: Fri, 30 Jul 2010 09:15:38 -0400
To: bug-DBIx-Class-Schema-Loader [...] rt.cpan.org
From: Rafael Kitover <rkitover [...] io.com>
Is that the full error message? The redefined message is just a warning. Please attach a test app/schema. "Mark Hedges via RT" <bug-DBIx-Class-Schema-Loader@rt.cpan.org> wrote: Show quoted text
> Queue: DBIx-Class-Schema-Loader > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=59849 > > >BTW it doesn't matter if I rename the method in the defined package >under the namespace to something else. Any method name fails. > >setting debug_1 shows everything working okay, then > ># Loaded external class definition for 'DeSpam::DC::Service' >(and 3 other external class definition libs) > >... and then the error when my test script tries to get the schema ... > >Cannot connect schema: 'Failed to reload class DeSpam::DC::Service: >Subroutine get_despam_service redefined at >/tmp/dbic4VsY/DeSpam/DC/Service.pm line 213. >
-- Sent from my Android phone with K-9 Mail. Please excuse my brevity.
This just won't go away. On Mon Aug 16 09:41:12 2010, RKITOVER wrote: Show quoted text
> Is that the full error message? The redefined message is just a > warning. Please attach a test app/schema.
That is the full error message, and it dies. I have already attached a tarball of test script with files that you can drop into the build directory for 0.07001. I just tried this: 1) removed perl, perl yum packages and /usr/lib/perl5 2) reinstalled perl yum package (5.8.8-32.el5_5.1) 3) reinstalled all libs from CPAN 3) updated every lib that came with yum that could be updated Then I tried building from source package of 0.07001. All of the test worked, except the one that I wrote and uploaded to this bug report earlier. The result is the same. Every time it gets the namespace right and finds a file-defined package in t/lib with extra methods, it issues the redefined subroutine method and then dies. Thanks. --mark-- hedges@vm1:~/src/DBIx-Class-Schema-Loader-0.07001$ prove -v t/50addl_base_classes.t t/50addl_base_classes.t .. 1..35 # DBIx::Class::Schema::Loader::Base says use_namespaces is the default # In the first test run, then, Foo should be a DBICTestMethods::Namespaces::Schema::Result::Foo ok 1 - (naming => 'current') get schema ok 2 - (naming => 'current') get a ResultSet for Foo ok 3 - (naming => 'current') get the first foo ok 4 - (naming => 'current') $foo is defined # foo's class is DBICTestMethods::Namespaces::Schema::Foo not ok 5 - (naming => 'current') $foo is a DBICTestMethods::Namespaces::Schema::Result::Foo # Failed test '(naming => 'current') $foo is a DBICTestMethods::Namespaces::Schema::Result::Foo' # at t/50addl_base_classes.t line 104. not ok 6 - (naming => 'current') call the file-defined Foo->biz method # Failed test '(naming => 'current') call the file-defined Foo->biz method' # at t/50addl_base_classes.t line 110. # died: Can't locate object method "biz" via package "DBICTestMethods::Namespaces::Schema::Foo" at t/50addl_base_classes.t line 109. ok 7 # skip no point in checking value if method was not found # In the second test run with use_namespaces => 0 (backcompat), Foo should be a DBICTestMethods::Backcompat::Schema not ok 8 - (naming => 'current', use_namespaces => 0) get schema # Failed test '(naming => 'current', use_namespaces => 0) get schema' # at t/50addl_base_classes.t line 79. # died: Failed to reload class DBICTestMethods::Backcompat::Schema::Foo: Subroutine biz redefined at /tmp/dbicyGEp/DBICTestMethods/Backcompat/Schema/Foo.pm line 90. # Compilation failed in require at (eval 374) line 1. ok 9 # skip no point in checking if schema could not be connected ok 10 # skip no point in checking if schema could not be connected ok 11 # skip no point in checking if schema could not be connected ok 12 # skip no point in checking if schema could not be connected ok 13 # skip no point in checking if schema could not be connected ok 14 # skip no point in checking if schema could not be connected # In the third test, with use_namespaces => 1, Foo gets the explicit Result class again not ok 15 - (naming => 'current', use_namespaces => 1) get schema # Failed test '(naming => 'current', use_namespaces => 1) get schema' # at t/50addl_base_classes.t line 79. # died: Failed to reload class DBICTestMethods::Namespaces::Schema::Result::Foo: Subroutine biz redefined at /tmp/dbicugSd/DBICTestMethods/Namespaces/Schema/Result/Foo.pm line 90. # Compilation failed in require at (eval 395) line 1. ok 16 # skip no point in checking if schema could not be connected ok 17 # skip no point in checking if schema could not be connected ok 18 # skip no point in checking if schema could not be connected ok 19 # skip no point in checking if schema could not be connected ok 20 # skip no point in checking if schema could not be connected ok 21 # skip no point in checking if schema could not be connected # try it in full backcompat 0.04006 mode with no schema options Dynamic schema detected, will run in 0.04006 mode. Set the 'naming' attribute or the SCHEMA_LOADER_BACKCOMPAT environment variable to disable this warning. Also consider setting 'use_namespaces => 1' if/when upgrading. See perldoc DBIx::Class::Schema::Loader::Manual::UpgradingFromV4 for more details. not ok 22 - (no naming or namespaces options (0.04006 mode)) get schema # Failed test '(no naming or namespaces options (0.04006 mode)) get schema' # at t/50addl_base_classes.t line 79. # died: Failed to reload class DBICTestMethods::Backcompat::Schema::Foo: Subroutine biz redefined at /tmp/dbicY8Kk/DBICTestMethods/Backcompat/Schema/Foo.pm line 90. # Compilation failed in require at (eval 421) line 1. ok 23 # skip no point in checking if schema could not be connected ok 24 # skip no point in checking if schema could not be connected ok 25 # skip no point in checking if schema could not be connected ok 26 # skip no point in checking if schema could not be connected ok 27 # skip no point in checking if schema could not be connected ok 28 # skip no point in checking if schema could not be connected # try it in backcompat mode (no naming option) but with use_namespaces => 1 Dynamic schema detected, will run in 0.04006 mode. Set the 'naming' attribute or the SCHEMA_LOADER_BACKCOMPAT environment variable to disable this warning. Also consider setting 'use_namespaces => 1' if/when upgrading. See perldoc DBIx::Class::Schema::Loader::Manual::UpgradingFromV4 for more details. not ok 29 - (no naming or namespaces options (0.04006 mode)) get schema # Failed test '(no naming or namespaces options (0.04006 mode)) get schema' # at t/50addl_base_classes.t line 79. # died: Failed to reload class DBICTestMethods::Namespaces::Schema::Result::Foo: Subroutine biz redefined at /tmp/dbic2o0C/DBICTestMethods/Namespaces/Schema/Result/Foo.pm line 90. # Compilation failed in require at (eval 442) line 1. ok 30 # skip no point in checking if schema could not be connected ok 31 # skip no point in checking if schema could not be connected ok 32 # skip no point in checking if schema could not be connected ok 33 # skip no point in checking if schema could not be connected ok 34 # skip no point in checking if schema could not be connected ok 35 # skip no point in checking if schema could not be connected # Looks like you failed 6 tests of 35. Dubious, test returned 6 (wstat 1536, 0x600) Failed 6/35 subtests (less 25 skipped subtests: 4 okay) Test Summary Report ------------------- t/50addl_base_classes.t (Wstat: 1536 Tests: 35 Failed: 6) Failed tests: 5-6, 8, 15, 22, 29 Non-zero exit status: 6 Files=1, Tests=35, 1 wallclock secs ( 0.01 usr 0.04 sys + 0.62 cusr 0.54 csys = 1.21 CPU) Result: FAIL
Subject: problems loading methods from file-defined classes + namespaces seem wrong
Uhhhh.... The only thing I've done between my last report and now was, I installed Apache::Session 1.88 from source since it seems to stall out on an uninitialized value warning when installed with CPAN. Now I get the schema every time for each one of the test sequences in my additional test (./t/50addl_base_classes.t). The only remaining problems are the conflicts with the namespaces option which seems like it is a separate issue. Is this related to the time of day that I'm running the test??? This is silly. prove -v ./t/50addl_base_classes.t ./t/50addl_base_classes.t .. 1..35 # DBIx::Class::Schema::Loader::Base says use_namespaces is the default # In the first test run, then, Foo should be a DBICTestMethods::Namespaces::Schema::Result::Foo ok 1 - (naming => 'current') get schema ok 2 - (naming => 'current') get a ResultSet for Foo ok 3 - (naming => 'current') get the first foo ok 4 - (naming => 'current') $foo is defined # foo's class is DBICTestMethods::Namespaces::Schema::Foo not ok 5 - (naming => 'current') $foo is a DBICTestMethods::Namespaces::Schema::Result::Foo # Failed test '(naming => 'current') $foo is a DBICTestMethods::Namespaces::Schema::Result::Foo' # at ./t/50addl_base_classes.t line 104. not ok 6 - (naming => 'current') call the file-defined Foo->biz method # Failed test '(naming => 'current') call the file-defined Foo->biz method' # at ./t/50addl_base_classes.t line 110. # died: Can't locate object method "biz" via package "DBICTestMethods::Namespaces::Schema::Foo" at ./t/50addl_base_classes.t line 109. ok 7 # skip no point in checking value if method was not found # In the second test run with use_namespaces => 0 (backcompat), Foo should be a DBICTestMethods::Backcompat::Schema ok 8 - (naming => 'current', use_namespaces => 0) get schema ok 9 - (naming => 'current', use_namespaces => 0) get a ResultSet for Foo ok 10 - (naming => 'current', use_namespaces => 0) get the first foo ok 11 - (naming => 'current', use_namespaces => 0) $foo is defined # foo's class is DBICTestMethods::Backcompat::Schema::Foo ok 12 - (naming => 'current', use_namespaces => 0) $foo is a DBICTestMethods::Backcompat::Schema::Foo ok 13 - (naming => 'current', use_namespaces => 0) call the file-defined Foo->biz method ok 14 - (naming => 'current', use_namespaces => 0) biz() method returns correct string # In the third test, with use_namespaces => 1, Foo gets the explicit Result class again ok 15 - (naming => 'current', use_namespaces => 1) get schema ok 16 - (naming => 'current', use_namespaces => 1) get a ResultSet for Foo ok 17 - (naming => 'current', use_namespaces => 1) get the first foo ok 18 - (naming => 'current', use_namespaces => 1) $foo is defined # foo's class is DBICTestMethods::Namespaces::Schema::Foo not ok 19 - (naming => 'current', use_namespaces => 1) $foo is a DBICTestMethods::Namespaces::Schema::Result::Foo # Failed test '(naming => 'current', use_namespaces => 1) $foo is a DBICTestMethods::Namespaces::Schema::Result::Foo' # at ./t/50addl_base_classes.t line 104. not ok 20 - (naming => 'current', use_namespaces => 1) call the file-defined Foo->biz method # Failed test '(naming => 'current', use_namespaces => 1) call the file-defined Foo->biz method' # at ./t/50addl_base_classes.t line 110. # died: Can't locate object method "biz" via package "DBICTestMethods::Namespaces::Schema::Foo" at ./t/50addl_base_classes.t line 109. ok 21 # skip no point in checking value if method was not found # try it in full backcompat 0.04006 mode with no schema options ok 22 - (no naming or namespaces options (0.04006 mode)) get schema ok 23 - (no naming or namespaces options (0.04006 mode)) get a ResultSet for Foo ok 24 - (no naming or namespaces options (0.04006 mode)) get the first foo ok 25 - (no naming or namespaces options (0.04006 mode)) $foo is defined # foo's class is DBICTestMethods::Backcompat::Schema::Foo ok 26 - (no naming or namespaces options (0.04006 mode)) $foo is a DBICTestMethods::Backcompat::Schema::Foo ok 27 - (no naming or namespaces options (0.04006 mode)) call the file-defined Foo->biz method ok 28 - (no naming or namespaces options (0.04006 mode)) biz() method returns correct string # try it in backcompat mode (no naming option) but with use_namespaces => 1 ok 29 - (no naming or namespaces options (0.04006 mode)) get schema ok 30 - (no naming or namespaces options (0.04006 mode)) get a ResultSet for Foo ok 31 - (no naming or namespaces options (0.04006 mode)) get the first foo ok 32 - (no naming or namespaces options (0.04006 mode)) $foo is defined # foo's class is DBICTestMethods::Namespaces::Schema::Foo not ok 33 - (no naming or namespaces options (0.04006 mode)) $foo is a DBICTestMethods::Namespaces::Schema::Result::Foo # Failed test '(no naming or namespaces options (0.04006 mode)) $foo is a DBICTestMethods::Namespaces::Schema::Result::Foo' # at ./t/50addl_base_classes.t line 104. not ok 34 - (no naming or namespaces options (0.04006 mode)) call the file-defined Foo->biz method # Failed test '(no naming or namespaces options (0.04006 mode)) call the file-defined Foo->biz method' # at ./t/50addl_base_classes.t line 110. # died: Can't locate object method "biz" via package "DBICTestMethods::Namespaces::Schema::Foo" at ./t/50addl_base_classes.t line 109. ok 35 # skip no point in checking value if method was not found # Looks like you failed 6 tests of 35. Dubious, test returned 6 (wstat 1536, 0x600) Failed 6/35 subtests (less 3 skipped subtests: 26 okay) Test Summary Report ------------------- ./t/50addl_base_classes.t (Wstat: 1536 Tests: 35 Failed: 6) Failed tests: 5-6, 19-20, 33-34 Non-zero exit status: 6 Files=1, Tests=35, 1 wallclock secs ( 0.02 usr 0.03 sys + 0.31 cusr 0.31 csys = 0.67 CPU) Result: FAIL
Subject: updated test files
RT-Send-CC: rkitover [...] cpan.org
Here's an updated tarball of test files and libs with corrected description on one test. I do not understand why the error about redefined subroutines and is gone now and I get the schema every time. It doesn't seem like I changed anything relevant between now and the last time it was broken. However, there still seem to be some conflicts over whether to use the default Result:: namespace if 'use_namespaces' is specified or not, in combination with different 'naming' options.
Subject: DBICTestMethods_files.tar
Download DBICTestMethods_files.tar
application/x-tar 10k

Message body not shown because it is not plain text.

Subject: AHA my test forgot to "use blib"
RT-Send-CC: rkitover [...] cpan.org
OH, I get it, I forgot to "use blib", so the test (using `prove -v`) was using the old libs that worked. Sorry. HERE is a tarball of files to drop into 0.07001 that demonstrate the problem. Every time it gets the namespace correct and finds a file with additional methods, getting the schema dies with an error like "Failed to reload class DBICTestMethods::Namespaces::Schema::Result::Foo: Subroutine biz redefined at /tmp/dbicVnFt/DBICTestMethods/Namespaces/Schema/Result/Foo.pm line 90." That is not just a warning. It dies. Mark
Subject: DBICTestMethods_files_usethis.tar

Message body not shown because it is not plain text.

fixed in git
Fixed 0.07011