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

Hi fellow monks!

I would like to ask on what will be the best approach if you are using an old version of Perl or only a Perl Win32 version and most of the modules are not supported (e.g. File::Find, File::Copy).

I had made this perl script and this should be ran through a .bat file which calls a perl.exe (which a Win32 version, I think) and the said script.

An error is displayed "Can't locate strict.pm in @INC at C:\tmp\PerlScript.pl"

Upgrading is not an option and using a .bat file is the only way that is allowed to run the script. I had read that it is possible to download the missing modules and call it within the script. But I can't figure it out on how it should work.

Please kindly help! Thanks you so much!

Replies are listed 'Best First'.
Re: Can't locate .pm in @INC
by dasgar (Priest) on Nov 12, 2014 at 06:05 UTC

    My first instinct would be to upgrade to a newer version of Perl. Not sure why you say that upgrading is not an option, but I won't

    One option for you to do is to use App::FatPacker to "pack your dependencies onto your script file". I personally haven't used this module myself. For packing pure Perl modules needed by your script, there shouldn't be a problem. However, I'm not sure how well this module works with packing XS based modules.

    Another option would be to use the pp utility from the PAR::Packer module to bundle your script into a stand-alone executable that can be run on another system - even if that system does not have Perl installed.

    Since you're already familiar with Strawberry Perl and you can obviously transfer files to the system in question, here's another route that you could go. Download a portable version of Strawberry Perl. To use a version of portable Strawberry Perl, you just run a batch file that opens a new command prompt that has its environment variables set so that you can use the portable Strawberry Perl in just that command prompt. If you use a system with internet access, you can install any modules that you need to from CPAN. Then you can copy all of that plus your script to the system in question.

      One option for you to do is to use App::FatPacker to "pack your dependencies onto your script file". I personally haven't used this module myself.

      It comes with a frontend fatpack, it doesn't work on windows (just tried it)... last time I tried it in 2012 it didn't work either ... fatpack doesn't work for windows... not even in 2010

      cpanm comes packed with fatpack and it work well on windows, but fatpack doesn't work for packing stuff on windows

      $ cpanm App::FatPacker App::FatPacker is up to date. (0.010002) $ cat ddenvinc.pl #!/usr/bin/perl -- use strict; use warnings; use Data::Dump; dd(\%INC); dd(\%ENV); $ fatpack trace --to-stderr ddenvinc.pl ddenvinc.pl syntax OK

      Neither strict.pm nor warnings.pm nor Data/Dump.pm are mentioned, it just doesn't work

Re: Can't locate .pm in @INC
by Anonymous Monk on Nov 12, 2014 at 02:27 UTC

    Please post the output of perl.exe -V

      Thanks for the reply.

      Here what it says. I cut it to what I think is significant.

      This is perl, version 5.001

      Unofficial patchlevel 1m.

      Copyright1987-1994, Larry Wall

      Win32 port Copyright (c) 1995 Microsoft Corporation...(and other details)

      Perl for Win32 Build 110...(and other details)

      And btw, I build my script in strawberry.

        You ran perl -v which is not the same as what was asked for: perl -V.