Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

object version does not match

by Anonymous Monk
on May 09, 2024 at 11:57 UTC ( [id://11159353]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I've got this big old module that's been working fine for years. It's part of a larger mojo app but can also be used from the command line. I recently set up a new dev box and noticed that the module won't run from cli anymore, even though it still works in the mojo app, throwing this error:
B object version 1.88 does not match $B::VERSION 1.68 at 
/perlbrew/perls/perl-5.38.2/lib/5.38.2/darwin-2level/DynaLoader.pm line 227, <DATA> line 129.
BEGIN failed--compilation aborted at B.pm line 28, <DATA> line 129.
The module still works as expected on other machines. What does this error mean and how can it be fixed? Thanks

Replies are listed 'Best First'.
Re: object version does not match
by syphilis (Archbishop) on May 09, 2024 at 12:18 UTC
    What does this error mean and how can it be fixed?

    It means that, when perl-5.38.2 loads the B module (B.pm), instead of loading the correct version (1.88) of B.pm, it's loading a B.pm (version 1.68) from an older perl installation.
    You need to modify perl-5.38.2's @INC so that version 1.88 of B.pm is located and loaded *before* this old version of B.pm is located and loaded.

    If you require more assistance with this, it would help if you could provide the output of running:
    perl -le 'print $]; print for @INC;'
    Cheers,
    Rob
      Thank you Rob! I went on a safari for stray copies of B.pm on my system and found some strange things. The problem was caused by altering @INC with a use lib statement that exposed a folder that for some forgotten reason has an old copy of B.pm 1.68 renamed to b.pm. But this has been the case for years and it still works like that on my old box. I wonder why perl 5.26.2 on macos 10.13.4 ignores my local copy of B at b.pm but perl 5.38.2 on macos 14.3 tries to use it and gets confused? I also don't see why this doesn't bother apache or morbo in either case.

      The other oddity is not directly related to this problem but involves the system perl on Apple's latest macos: sonoma. My hunt for B.pm revealed that although the system perl is 5.30.3 there is also a full set of core modules for perl 5.34 installed from the factory:

      /System/Library/Perl/5.30/darwin-thread-multi-2level/B.pm
      /System/Library/Perl/5.34/darwin-thread-multi-2level/B.pm
      
      I guess they are planning an upgrade at some point... Thanks again!

      www.cpan.org/ports/binaries.html#macos

        I wonder why perl 5.26.2 on macos 10.13.4 ignores my local copy of B at b.pm but perl 5.38.2 on macos 14.3 tries to use it and gets confused?

        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.
        UPDATE: Hmmm ... apparently macos systems are typically case-insensitive, so I could be wrong there.

        Also, I think that 1.68 is the version that ships with perl-5.26.2, so it's more likely to be loading that B.pm .

        In addition to "use lib" directives, also check to see whether the PERL5LIB environment variable is pulling additional paths into @INC.
        Maybe it's set for your perl environment, but the apache environment doesn't see it.

        Anyway, you're on the right track.

        Cheers,
        Rob

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11159353]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2025-06-21 07:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.