in reply to Re^6: object version does not match
in thread object version does not match

Perl did what you told it to by saying use data::dumper: It's a problem inherent to case-insensitive (Windows as far as I know) and case-forgiving (MacOS as far as I know) OSes.

Replies are listed 'Best First'.
Re^8: object version does not match
by Anonymous Monk on May 13, 2024 at 23:33 UTC
    Thanks for breaking it down. Maybe perldoc was a bad example. What seems mysterious (buggy) to me is how my module breaks at the command line, because "use lib" points to a folder with the wrong version of B at b.pm, but somehow it still works with the morbo http server. Is it possible that Mojo::Server::Morbo uses the correct version of B and that overrides my "use lib" and the bogus b.pm it puts in @INC?
      Is it possible that Mojo::Server::Morbo uses the correct version of B and that overrides my "use lib" and the bogus b.pm it puts in @INC?

      Looking at what happens on my own case-insensitive system (Windows 11), it would be quite possible that Mojo::Server::Morbo loads b.pm without issue - but it would need to also load the appropriate "object" version (1.68) to avoid that "version mismatch" error.

      Does "use lib" specify a fully-qualified path, or does it specify a relative path (ie relative to ".") ?
      If it's a relative path, then Mojo::Server::Morbo might not be able to find b.pm (because it has a different idea about the location of ".").
      Therefore, it would have to look elsewhere, and eventually load the correct B.pm.

      My guess is that Mojo::Server::Morbo is loading (the correct) "B.pm", but I can't rule out the possibility that it's happily loading "b.pm".
      If you're able to temporarily edit or rename or remove this "b.pm", then you might get a better idea of what's happening.
      Better still, I think, if the opportunity to remove "b.pm" permanently exists.

      Cheers,
      Rob
        > My guess is that Mojo::Server::Morbo is loading (the correct) "B.pm"

        Good guess! I wrote some test code and used Devel::Modlist to prove to myself that Mojo::Server::Morbo uses B via Future and it ignores the old b.pm in "use lib". No such thing happens at the command line so it loads the old b.pm and fails.

        perl -MMojo::Server::Morbo -le 'print $B::VERSION'