Perl: Batch packer executable with Unicode :: GCString cannot find object method 'new'
I am using PAR :: Packer to create a Windows executable from a Perl script that uses a Unicode::GCString
module.
A stripped-down version of the script looks like this:
mwe.pl
#!/usr/bin/env perl
use strict;
use warnings;
use Unicode::GCString;
my $gcs = Unicode::GCString->new("hello world");
print $gcs->columns();
exit(0);
When I ran
perl mwe.pl
the output gives the "width" of the line:
11
which is as expected.
I am creating mwe.exe
with the command
pp -o mwe.exe mwe.pl
and when i run
mwe.exe
I am getting the error
Cannot find method of object "new" via package "Unicode :: GCString" in script / mwe.pl line 6
After reviewing AppData\Local\Temp\par-xxxxxx\cache-xxxxx\inc\lib
, I believe that it is Unicode::GCString
present, like Unicode::LineBreak
.
Does anyone have any ideas on how to fix this?
source to share
The solution might be to use this version of "pp" which I call "ppp.pl"
$ENV{PAR_VERBATIM}=1;
system 'pp', @ARGV;
Details https://metacpan.org/pod/distribution/PAR/lib/PAR/Environment.pod#PAR_VERBATIM
The reason is related to this error Error # 38271 for PAR-Packer: PodStrip does not separate "= encoding utf8", which causes the executable to be generated pp failed to execute
Also the pattern inside Unicode :: GCString
source to share