DynaLoader sees incorrect values ​​in @INC

I have several versions of Perl installed; each of which is in a different directory. for example C:\Perl\5.x.y. I switch between them in the shell, installing PERL5LIB and changing my PATH so that only one version is displayed at a time. This usually works fine, but when I try to run the version pp(PAR :: Packer) installed under 5.10.1, I have problems loading XS components. parll2nc.exe complains:

This application failed to start because perl512.dll was not found ...

I set PERL_DL_DEBUG and see the following when initializing DynaLoader:

DynaLoader.pm loaded (C:/Perl/5.10.1/site/lib C:/Perl/5.12.1/lib ., \lib)

Material before the comma @INC. The first entry is correct, the second is not. I can't figure out how DynaLoader gets the 5.12 lib path, since running perl directly shows what I would expect:

C:\>perl -e "print join ' ', @INC"
C:/Perl/5.10.1/site/lib C:/Perl/5.10.1/lib .

How does DynaLoader choose the wrong path and how can I prevent it?

+3
source share
2 answers

I get it. The problem is caused by the interaction of several things:

  • I have * .pl files associated with perl.exe (for the latest version of Perl installed - 5.12.1).
  • I have a ".PL" in my PATHEXT environment variable so that I can run Perl scripts without entering an extension. for example C:\>fooinsteadC:\>foo.pl
  • My utility installation ppdoes not have a wrapper for a batch file created with pl2bat. (I'm not sure why.)

, , pp @myconfig, :

C:\Perl\5.12.1\bin\perl.exe C:\Perl\5.10.1\site\bin\pp.pl @myconfig

. pp.pl , perl, *.pl , perl PATH. , libs @INC , (C:\Perl\5.12.1\lib), , PERL5LIB (C:\Perl\5.10.1\site\lib).

, pp perl pp.pl, (, ), . , .BAT PATHEXT .PL, pp Windows pp.bat pp.pl, pp.bat perl ( ).

+3

, , @INC , .

script use :

use Tie::Trace;
BEGIN { Tie::Trace::watch @INC };

, @INC.

+4

Source: https://habr.com/ru/post/1748607/


All Articles