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

>> I wonder why perl 5.26.2 on macos 10.13.4 ignores my local copy of B at b.pm

> I don't think that's actually happening.
> On a case-sensitive system (which yours is ?) "use B;" will not load b.pm because of the case mismatch.

You are right that 5.26.2 is not ignoring b.pm on my old system, but believe it or not it IS using b.pm, and since the version matched it worked. On my new box 5.38.2 was also trying to use b.pm so I renamed it and the problem evaporated. I'm not using apache on the new box yet, even though macs come with 2.4.56 included, but morbo is not bothered by b.pm for some reason.

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. You can also use lowercase module names when using them in one liners for OO modules, but to call functions you must use the proper case:

perl -Mdata::dumper -we'$d=Data::Dumper->new(\@ARGV);print$d->Dump' fo +o bar
$VAR1 = 'foo';
$VAR2 = 'bar';
perl -Mdata::dumper -we'print Dumper(\@ARGV)' foo bar
Undefined subroutine &main::Dumper called at -e line 1.

Replies are listed 'Best First'.
Re^5: object version does not match
by hippo (Archbishop) on May 10, 2024 at 06:39 UTC
    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:

    $ perl -E 'say $^O' linux $ perldoc -i data::dumper | head NAME Data::Dumper - stringified perl data structures, suitable for both printing and "eval" SYNOPSIS use Data::Dumper; # simple procedural interface print Dumper($foo, $bar); $

    🦛

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

        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.