0

I copied a Perl module (DBD::Pg) from one system to another to run some quick checks on a Mojolicious project. On the new system, it all works fine when I run it under morbo (the Mojolicious test web daemon). But when I try to run the tests (via the Module::Build installer), I get the error:

Perl API version v5.16.0 of DBD::Pg does not match v5.20.0 at /usr/local/lib/perl/DynaLoader.pm line 216.

I researched why I am getting this, and read the explanation in the perldoc. But since the project runs under morbo, that seems to imply to me that the version mismatch may be trivial in this case. It looks like PerlXS does make some allowances for disabling VERSIONCHECK, but I don't see how that can be applied when running a Perl script.

Randall
  • 2,859
  • 1
  • 21
  • 24
  • 3
    You get this error when the module was installed by a different version of Perl than the one currently being used. These (and other things) must match – ikegami Aug 22 '18 at 19:21
  • 4
    The mismatch is not trivial. 5.16 and 5.20 are two major releases apart and Perl is generally not binary compatible across those. – melpomene Aug 22 '18 at 19:40
  • 1
    If DBD::Pg loads under morbo, it's probably using a different perl. How many perls are there on your system? (Also, Module::Build is not a pragma.) – melpomene Aug 22 '18 at 19:43
  • @melpomene Wrong choice of terminolgy, then. Aside from being a Perl module, what is it? A convention? A paradigm? – Randall Aug 22 '18 at 19:47
  • It's just a module. – melpomene Aug 22 '18 at 19:48
  • It's used for installing modules, so you could call it an "installer" if you're looking for a purpose-related descriptor. – ikegami Aug 22 '18 at 20:30

1 Answers1

3

You can't copy non-pure Perl modules from one system to the next (or into one group of perl lib directories into another perl's). Generally the code in those modules is compiled against the specific perl binary. That binary could have linked to different libraries, changed how it does things, used a different compiler, and many other things. It may not even work if the perl versions are the same.

Instead, install the DBD::Pg for each perl that needs to use it.

brian d foy
  • 129,424
  • 31
  • 207
  • 592