On Mon, May 24, 2010 at 11:49 PM, Buddy Burden <barefootco...@gmail.com> wrote: > Chris, > >> Somewhere in the myriad of class loaders and syntax modifiers >> something is passing '0' to CMOP::load_class. It *looks* like this is >> coming from Devel::Declare (the thing MooseX::Declare uses to sugar up >> the syntax) getting confused when it parses the >> Company::CompanyBusinessModel during the dynamic load. Preloading it >> "fixes" this by making sure that the class is already loaded when it >> tries to bring it in (bypassing the auto-loading). > > Okay, but isn't the process that MooseX::Declare / Devel::Declare uses > when I say "use Company::CompanyBusinessModel" the same as the one it > uses when I say > "Class::MOP::load_class('Company::CompanyBusinessModel')"? Seems like > in both cases the parser would be doing the exact same things ... > after all, I can see that Class::MOP::load_class is just doing a > require under the hood, which is what use is doing as well ... right?
Similar but not the same. If nothing else one happens at compile time, one at runtime, meaning your environment and program state is completely different. >> Things to check would be your version of Devel::Declare, >> MooseX::Declare, Class::MOP, Moose etc to make sure they are up to >> date. > > I did check those at some point to make sure they were the same, and I > _thought_ I had verified we had the same versions everywhere ... let > me look again. > > perl -MMooseX::Declare -le 'no strict qw<refs>; our $ver = > "${_}::VERSION" and print "$_ :: $$ver" foreach qw<Moose > MooseX::Declare Class::MOP Devel::Declare>' > Moose :: 1.01 > MooseX::Declare :: 0.33 > Class::MOP :: 0.98 > Devel::Declare :: 0.005011 Same is not equivalent to "up to date". Your MXD and Devel::Declare are up to date (modulo support for 5.12) and I don't see anything in the change logs for CMOP or Moose that I can think would affect this. > And that does appear to be the same for both our production and > development environments. > >> Then I'd start working on getting the case reproducible *at all* >> (sounds like you can't get it to break outside of production, I hate >> bugs like that) and start stepping through and seeing where things go >> awry. > > Yes, so far my simple attempts to load it outside a larger context all > work. For instance, I can simply do this: > > perl -MCompany::Moose -le 'print > Company::Moose::load_class(qw<Company::CompanyBusinessModel>)' > 1 > > So I'm just not sure how much of the total context I need to reproduce > to get the error to fire. I was sort of hoping that this might be > something that folks around here would recognize, but it looks like > it's as bizarre to you guys as it is to us. :-) > > Okay, I'll try to break it down and see if I can come up with a > small(ish) example. Wish me luck ... It sounds familiar, but honestly I don't use Devel::Declare or MooseX::Declare and I try to avoid runtime loading of Classes so I haven't gotten bitten by anything like this in a couple years. Good luck, I'd start with the full setup and start removing things until it starts working again. Then binary search adding/removing code until I get a set that fails consistently. -Chris