I've been working with PAR::Packer to create standalone executable files out of Perl scripts. The only difficulty I have with it is figuring out what extra DLLs I have to force it to include via the -l
option.
I'm now working with a Perl script that requires Encoding with utf16-le. The Encode::find_encoding
function works just fine in the script, but it doesn't work after I have packaged it with pp
.
Here's a tiny script (let's call it encode.pl) to illustrate the problem:
use strict;
use warnings;
use Encode;
my $_UTF16 = Encode::find_encoding ('utf16-le');
print $_UTF16;
If you run this, it will print something like Encode::Unicode=HASH(xxxxxx)
. Pack it up with pp
, however, and it no longer works:
pp -o encode_test.exe encode_test.pl
Now when I run encode_test.exe, I get this:
Use of uninitialized value $_UTF16 in print at script/encode_test.pl line 5.
Can anyone tell me what I need to do (e.g. what libraries to include or any other solution) to make this work right even after packaging with pp
?
Running
pp
with the-x
option works, of course, but using it was unacceptable in my case because this runs the program, and since this is a GUI application this command would no longer be automatable.The culprit was a run-time require used by Encode.pm, line 120, to load Encode::Unicode. To make this program work, I used the following:
Note that using backslashes (the Windows way) causes a failure in the
pp
command, so those had to be replaced with forward slashes.