Closed rabbiveesh closed 4 years ago
I'm also having this issue.
I'm also having exactly the same issue.
I changed DBIx::Class::Migration::RunScript line 111 to
my $traits_path = $INC{'MooX/Traits.pm'};
and the warnings went away. The module uses with 'MooX::Traits';
, and per MooX::Traits::Util, if you are using with
, you are using MooX::Traits, NOT MooX::Traits::Util.
MooX::Traits itself uses the ::Util package. If I change line 113 on my copy, t/runscript.t stops passing.
I don't currently have a way to repro this myself. Can someone provide here steps to do so? I've got the latest MooX::Traits (0.05), which is also the required version in latest DBICM.
I made a repo that shows the bug. It only comes up when you're using a perl script for the migration. Please see https://github.com/rabbiveesh/dbicm-bug
@rabbiveesh Thank you! The repro works for me (i.e., produces all the warnings) on Ubuntu 18.04.1 LTS.
Use of uninitialized value $traits_path in string ne at /home/me/perl5/lib/perl5/DBIx/Class/Migration/RunScript.pm line 113.
I get the same on Lubuntu Eoan, DBIx::Class::Migration v0.074 (latest). The fix in my https://github.com/jjn1056/DBIx-Class-Migration/issues/130#issuecomment-565671773 worked.
@cxw42 The fix doesn't actually fix the issue, I'll explain.
The code that's triggering the warnings is supposed to look for anything in the namespace of DBIx::Class::Migration::RunScript::Trait
, which would be a plugin. It's meant to match anything other than a RunScript object that's already had the traits mixed in, which would have an entry in %INC
of whatever MooX::Trait::Util
does, b/c that's how applying roles works with that, apparently.
So in the real life case of using migrate without specifying any plugins, MooX::Trait::Util
has not been loaded yet, which is why there are so many warnings.
Now, I'm not sure yet if that's even supposed to happen in the real world, so I don't know if the test that's there is a false failure.
I'm gonna look at this issue a bit more, and then make a pull request, I think.
@rabbiveesh Thanks for the explanation and for looking into this! You definitely know more of the internals than I do :) .
When I install fixtures, I get the following warning over 500 times:
Use of uninitialized value $traits_path in string ne at <my local::lib>/DBIx/Class/Migration/RunScript.pm line 113.
I took a look over there, and it seems like that line checks for plugins loaded other thanMooX::Traits::Utils
. But for some reason, it doesn't seem to have that loaded, so it comes up as undefined in the match, leading to countless warnings.I'm using the latest version from CPAN, by the way (0.074). It seems to be called by my migrate script, which uses the
migrate
function. Any help would be appreciated.