http://qs321.pair.com?node_id=11108160


in reply to Can't locate strict.pm in @INC (@INC contains: .)

As Corion already noted, perl runs ActiveState Perl instead of Strawberry on that system. It's a minor red flag (pinkish flag?) for me that 5.6.1 was already at least ten years old when that server was deployed, so I'd take a careful look for any legacy Perl code on that system, to make sure nothing breaks. If you install Strawberry for a single user (rather than system-wide), it's relatively safe, unless of course that user is the one the scripts run as. Then you can fix the paths for Strawberry Perl.

If you run C:\Strawberry\perl\bin\perl.exe -eprint@INC, do you get a more reasonable list? If so, the @INC problem will hopefully stay with the ActiveState install. But if not, it may be a system config issue. In that case, I'd start with an envdump a look at your environment variables to see if any PERL* environment variables have been set, such as PERL5LIB, and if they are, track down where they're being set on your system.

If you're confident you've identified all Perl code on the system (if any), and confirmed it'll run on the latest Strawberry Perl, you can probably get rid of the AS Perl install. It's normally fine to have them both installed, as long as you manage your paths properly, but if it's a broken (and ancient) install anyway, you may be better off without it.

Replies are listed 'Best First'.
Re^2: Can't locate strict.pm in @INC (@INC contains: .)
by Weiling (Novice) on Oct 31, 2019 at 10:43 UTC
    Thanks for your answer. Hum, don't remember how Strawberry was install, not sure for the single user. I really don't know how to fix that path or anything else, i feel like in a huge ocean without a buoy! ^^ Here's the result of the commande C:\Strawberry\perl\bin\perl.exe -eprint@INC
    PS C:\Users\*****> C:\Strawberry\perl\bin\perl.exe -eprint@INC C:/Strawberry/perl/site/libC:/Strawberry/perl/vendor/libC:/Strawberry/ +perl/libPS
    I have to find how to launch an envdump to see if any PERL* environment variables have been set. All scripts are OK, i test them on the last strawberry version on my own computer.

      Sorry for the confusion on "envdump". That just means "environment dump," but more generally, simply having a look at the environment variables on your system, which I explained how to do in this other reply in this question thread.

      However, the results of your print @INC seem fine, so once you get your paths sorted out so C:\Strawberry\perl\bin comes before ActiveState's directory in your PATH, you'll be running Strawberry Perl whenever you simply run perl, without the need for the fully qualified path.

        Alleluia! I finally uninstall Strawberry 5.30 and reinstall ActivePerl 5.28, and it works! Have to find how to update the perllib and it will be OK! Bug thanks to all of you for the help! i'm really gratefull!

        EDIT: Ouch... not so perfect.. I just try to install a module on cpan (without internet), and i have a error message...

        PS E:\data\Perl\script\modulecpan\DBD-mysql-4.050> perl .\Makefile Backslash found where operator expected at .\Makefile line 39, near "W +INDOWS\" Backslash found where operator expected at .\Makefile line 39, near "s +ystem32\" Semicolon seems to be missing at .\Makefile line 51. Warning: Use of "-s" without parentheses is ambiguous at .\Makefile li +ne 52. String found where operator expected at .\Makefile line 52, near "L"E: +\Outils_Exploit\Strawberry\perl\lib\CORE"" String found where operator expected at .\Makefile line 52, near "L"E: +\Outils_Exploit\Strawberry\c\lib"" Warning: Use of "-s" without parentheses is ambiguous at .\Makefile li +ne 53. String found where operator expected at .\Makefile line 53, near "L"E: +\Outils_Exploit\Strawberry\perl\lib\CORE"" String found where operator expected at .\Makefile line 53, near "L"E: +\Outils_Exploit\Strawberry\c\lib"" Semicolon seems to be missing at .\Makefile line 58. Backslash found where operator expected at .\Makefile line 60, near "O +utils_Exploit\" Backslash found where operator expected at .\Makefile line 60, near "S +trawberry\" Backslash found where operator expected at .\Makefile line 60, near "p +erl\" Backslash found where operator expected at .\Makefile line 60, near "s +ite\" Backslash found where operator expected at .\Makefile line 61, near "O +utils_Exploit\" Backslash found where operator expected at .\Makefile line 61, near "S +trawberry\" Backslash found where operator expected at .\Makefile line 61, near "p +erl\" Backslash found where operator expected at .\Makefile line 61, near "s +ite\" Backslash found where operator expected at .\Makefile line 63, near "O +utils_Exploit\" Backslash found where operator expected at .\Makefile line 63, near "S +trawberry\" Backslash found where operator expected at .\Makefile line 63, near "p +erl\" Backslash found where operator expected at .\Makefile line 63, near "v +endor\" Backslash found where operator expected at .\Makefile line 64, near "O +utils_Exploit\" Backslash found where operator expected at .\Makefile line 64, near "S +trawberry\" Backslash found where operator expected at .\Makefile line 64, near "p +erl\" Backslash found where operator expected at .\Makefile line 64, near "v +endor\" Can't modify constant item in scalar assignment at .\Makefile line 39, + near "C:" syntax error at .\Makefile line 39, near "C:" Unknown regexp modifier "/O" at .\Makefile line 69, at end of line Unknown regexp modifier "/t" at .\Makefile line 69, at end of line Regexp modifiers "/u" and "/l" are mutually exclusive at .\Makefile li +ne 69, at end of line Unknown regexp modifier "/_" at .\Makefile line 69, at end of line Unknown regexp modifier "/E" at .\Makefile line 69, at end of line Regexp modifiers "/u" and "/l" are mutually exclusive at .\Makefile li +ne 69, at end of line Unknown regexp modifier "/t" at .\Makefile line 69, at end of line Unknown regexp modifier "/e" at .\Makefile line 69, at end of line .\Makefile has too many errors.
        Seem's he look on a previons path where it was installed
        Hi everyone, Just FYI, i finally made it... I just wipe all version's of Perl i had on the server, then reinstall a proper and more recent version of ActivePerl, with an other version of Strawberry Perl. Then i check my windows path to be sur eveything is ok. Now both perl work well! Big thanks to all of you! And for you'r patience .. :D
        Ok, after modify the patch and a reboot, situation evolving.. a little. When i try to launch a perl script, i have this error message, who's not the same as earlier:
        PS E:\data\Perl\script> perl -V nul: Perl lib version (5.28.1) doesn't match executable 'C:\Strawberry +\perl\bin\perl.exe' version (5.30.0) at C:/Strawbe rry/perl/lib/Config.pm line 62. Compilation failed in require. BEGIN failed--compilation aborted.
        Here's with the line i have in "PATH" as system variables:
        D:\Puppet Labs\Puppet\puppet\bin;D:\Puppet Labs\Puppet\facter\bin;D:\P +uppet Labs\Puppet\hiera\bin;D:\Puppet Labs\Puppet\bin;D:\Puppet Labs\ +Puppet\sys\ruby\bin;D:\Puppet Labs\Puppet\sys\tools\bin;C:\WINDOWS\sy +stem32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\Window +sPowerShell\v1.0\;C:\SCRIPTS\DIG\;D:\Puppet Labs\Puppet\bin;C:\Progra +m Files\7-Zip;C:\Program Files (x86)\Gpg4win\..\GnuPG\bin;C:\Windows\ +System32;C:\Program Files\PuTTY\;E:\Outils_Exploit\Wamp64\bin\php\php +7.3.5;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\p +erl\bin
        As you can see, there is no trace of "ActiveState". I don't understand, should i change the Strawberry line in first place?