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? > 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 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 ... -- Buddy