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

>> I don't know why but on macOS you can type perldoc data::dumper and it will work, but on Linux you must spell it Data::Dumper

> Or simply use the -i flag as intended

You can do that but the point of my demonstration is that perl seems kinda buggy on a case insensitive file system because there are no warnings nor failures due to mis-capitalized module names.

Replies are listed 'Best First'.
Re^7: object version does not match
by etj (Priest) on May 11, 2024 at 10:56 UTC
    Perl did what you told it to by saying use data::dumper:
    • find in @INC a data/dumper.pm (the OS showed one exists)
    • load it (worked)
    • import from that namespace (didn't work because that file doesn't define exactly that namespace and Perl isn't case-forgiving)
    It's a problem inherent to case-insensitive (Windows as far as I know) and case-forgiving (MacOS as far as I know) OSes.
      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