Library issue while using perl2exe

1.9k views Asked by At

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'.

3

There are 3 answers

0
Anoop Sethu On BEST ANSWER

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.

0
Mark P On

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.

0
Ben Law On

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.