1

I am trying to convert my Perl script to standalone exe. I assume perl2exe is a tool that serves this purpose. More or less.

When I am trying to generate the exe file, I am getting library issues.

One of the library issues is:

Warning: Can't locate VMS/Stdio.pm
at C:\Perl\lib\File\Temp.pm line 19
@INC = C:\Perl\site\lib, C:\Perl\lib, ., C:\Perl\lib\Digest, must be directory, not file)

When I went to line 19 of Temp.pm, the line is written as follows:

require VMS::Stdio if $^O eq 'VMS';

But,my OS is MSWin32. I am coming to a conclusion that, perl2exe is not compiling the script properly. Its reading my OS wrong.

Sample script is as follows:

my_libraries.pl

use Tk;
use lib 'C:\Perl\lib\Digest';
use strict;
use strict;
use warnings;
use strict;
use warnings;
use LWP::Simple qw(getstore);
use LWP::UserAgent;
use Digest::MD5    qw( md5_hex );
use Digest::MD5::File qw( file_md5_hex );
use File::Fetch;
use WWW::Mechanize ;
use Tk::ErrorDialog;


c:\perl2exe\perl2exe-16.00-Win> perl2exe my_libraries.pl my_libraries.exe


Warning: Can't locate File/BSDGlob.pm
    at C:\Perl\lib\File\GlobMapper.pm line 13
    @INC = C:\Perl\site\lib, C:\Perl\lib, ., C:\Perl\lib\Digest, must be directory, not file)

Warning: Can't locate Digest/Perl/MD5.pm
    at C:\Perl\lib\Digest\MD5.pm line 30
    @INC = C:\Perl\site\lib, C:\Perl\lib, ., C:\Perl\lib\Digest, must be directory, not file)

Warning: Can't locate VMS/Stdio.pm
    at C:\Perl\lib\File\Temp.pm line 19
    @INC = C:\Perl\site\lib, C:\Perl\lib, ., C:\Perl\lib\Digest, must be directory, not file)

Warning: Can't locate VMS/DCLsym.pm
    at C:\Perl\lib\IPC\Cmd.pm line 227
    @INC = C:\Perl\site\lib, C:\Perl\lib, ., C:\Perl\lib\Digest, must be directory, not file)

Warning: Can't locate VMS/Filespec.pm
    at C:\Perl\lib\ExtUtils\Manifest.pm line 31
    @INC = C:\Perl\site\lib, C:\Perl\lib, ., C:\Perl\lib\Digest, must be directory, not file)

Warning: Can't locate HTML/FormatText.pm
    at C:\Perl\lib\HTML\Element.pm line 1297
    @INC = C:\Perl\site\lib, C:\Perl\lib, ., C:\Perl\lib\Digest, must be directory, not file)

Sorry. let me put my obvious question here: Why is perl2exe giving library issues which are not intended to come? Is it a bug in perl2exe or am I doing something wrong? I mean, you can see in line 19 that if the OS is 'VMS', then stdio.pm is required. My os is 'MSWin32'.

Machavity
  • 30,841
  • 27
  • 92
  • 100
  • 1
    What is your question? You seemed to have only identified an issue so far. – arco444 Sep 29 '14 at 15:17
  • 2
    @arco444 I'll take a wild guess. Perhaps, "Why is it doing this and how can I fix it?" – ThisSuitIsBlackNot Sep 29 '14 at 15:23
  • I am sorry. Added my question to the last part of post. – Anoop Sethu Sep 29 '14 at 15:28
  • 2
    perl2exe finds all the `use` and `require` statements and tries to pull those modules. If you have `use` at the beginning of a line in a heredoc it will pick that up too. Remember, when you run perl2exe, it is zipping up the install of Perl on your machine with your perl script. When run, it unzips the Perl install into temp and runs your script using that version of Perl. You should be able to just create modules with those names in the right location and it might stop complaining. Also are these just warnings? Or does this cause your build of the exe to fail? – hmatt1 Sep 29 '14 at 15:33
  • chilemagic Its not 'just warnings'. Its weird warnings. And No. The exe file is not properly generated. Can't locate overloading.pm in @INC (@INC contains: C:\Perl\lib\Digest PERL2EXE_STORAGE c:\perl2exe\perl2exe-16.00-Win BEGIN failed--compilation aborted at PERL2EXE_STORAGE/overload.pm line 85. Compilation failed in require at PERL2EXE_STORAGE/URI.pm line 28. BEGIN failed--compilation aborted at PERL2EXE_STORAGE/URI.pm line 28. Compilation failed in require at (eval 24) line 2. Compilation failed in require at PERL2EXE_STORAGE/HTTP/Request.pm line 3. – Anoop Sethu Sep 29 '14 at 15:38
  • A quick reading of `pxman.html` mentions a "Pragma" of the form `#perl2exe_exclude modulename`. Is that of any assistance? – tjd Sep 29 '14 at 15:39
  • Let me rephrase my question: Is perl2exe reliable? I mean, have anyone used perl2exe to compile scripts which uses wide range of libraries? If yes, how the hell did they do it? – Anoop Sethu Sep 29 '14 at 15:44
  • 2
    @AnoopSethu what version of perl do you have installed? perl2exe is reliable when it builds, but it only support limited versions. An alternative tool is `Par::Packer` and `pp` http://search.cpan.org/~rschupp/PAR-Packer-1.022/lib/PAR/Packer.pm http://search.cpan.org/~rschupp/PAR-Packer-1.018/lib/pp.pm – hmatt1 Sep 29 '14 at 15:46
  • I had a hard time installing PAR-Packer and pp. I installed pp as per instructions. But, not able to access pp command from cmd. – Anoop Sethu Sep 29 '14 at 15:48
  • @AnoopSethu what version of Perl are you using though? Do you have more than one installation of Perl on your machine? – hmatt1 Sep 29 '14 at 16:03
  • Versin: v5.16.3 No other versions installed. – Anoop Sethu Sep 29 '14 at 16:11
  • `use strict; use strict; use warnings; use strict; use warnings;` What's this—extra protection? – Borodin May 19 '18 at 16:08

3 Answers3

0

I tried a to z possible remediation to make the perl2exe work. I removed the sections that was producing warnings (Hacked the modules). Studied and tried various flags. I have to say it is not at all feasible to convert Perl programs using diverse modules to exe files using perl2exe.

I found a software that exactly did what I wanted- Cava Packager. It took sometime to find the below page- How can I package my Perl script to run on a machine without Perl?

It converted my Perl program to Exe and also generated an installation file. Awesome.

Thanks, Anoop.

Community
  • 1
  • 1
0

The problem is

C:\Perl\lib\File\Temp.pm line 19

Open the file you will see this

require VMS::Stdio if $^O eq 'VMS';

Change the file not read-only, then place # for this line, go back to perl2exe the file again, then it should be gone.

Joe C
  • 15,324
  • 8
  • 38
  • 50
Ben Law
  • 23
  • 3
0

It may be of interest to readers of this issue that in addition to the VMS/Stdio.pm error, I also received "Can't locate the.pm". The line in my perl code that it pointed to was the text "Use the 't' command..." that was inside a double-quoted print statement. Apparently perl2exe looked for the 'use' statement regardless of where in my code it appeared. The fix was to either re-word the text to remove the word 'use' or put the text in single quotes.

Mark P
  • 11
  • 2