3

I'm using the PAR::Packer module to create a Windows executable of a Perl script that uses the Unicode::GCString module.

A stripped down version of the script is as follows:

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 run

perl mwe.pl

the output gives the 'width' of the string:

11

which is as expected.

I create mwe.exe using the command

 pp -o mwe.exe mwe.pl

and when I run

 mwe.exe

I receive the error

Can't locate object method "new" via package "Unicode::GCString" at script/mwe.pl line 6

Having reviewed AppData\Local\Temp\par-xxxxxx\cache-xxxxx\inc\lib, I believe that Unicode::GCString is present, as is Unicode::LineBreak.

Does anyone have any ideas on how to fix this?

cmhughes
  • 911
  • 1
  • 8
  • 17
  • I *think* this will be to do with the dynamic libraries used by the `GCString` module -- I don't think that I'm telling the `PAR::Packer` module to include them, and I think this is the problem. Perhaps a helpful en-route question might be: how do I find the path to the dynamic libraries? – cmhughes Apr 23 '17 at 18:36

1 Answers1

3

A solution can be to use this version of "pp" I call it "ppp.pl"

$ENV{PAR_VERBATIM}=1;
system 'pp', @ARGV;

Details at https://metacpan.org/pod/distribution/PAR/lib/PAR/Environment.pod#PAR_VERBATIM

The cause is related to this bug Bug #38271 for PAR-Packer: PodStrip does not strip "=encoding utf8" which cause the executable generated by pp failed to exec

Also the boilerplate inside Unicode::GCString

optional
  • 2,061
  • 12
  • 16