Perl:par 加壳程序可执行文件 Unicode::GCString,无法定位对象方法 "new"
Perl: par packer executable with Unicode::GCString, Can't locate object method "new"
我正在使用 PAR::Packer 模块创建使用 Unicode::GCString
模块的 Perl 脚本的 Windows 可执行文件。
脚本的精简版本如下:
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);
当我运行
perl mwe.pl
输出给出字符串的'width':
11
符合预期。
我使用命令
创建mwe.exe
pp -o mwe.exe mwe.pl
当我 运行
mwe.exe
我收到错误
Can't locate object method "new" via package "Unicode::GCString" at
script/mwe.pl line 6
查看 AppData\Local\Temp\par-xxxxxx\cache-xxxxx\inc\lib
后,我相信 Unicode::GCString
和 Unicode::LineBreak
一样存在。
有没有人知道如何解决这个问题?
一个解决方案是使用这个版本的 "pp" 我称之为 "ppp.pl"
$ENV{PAR_VERBATIM}=1;
system 'pp', @ARGV;
详情见 https://metacpan.org/pod/distribution/PAR/lib/PAR/Environment.pod#PAR_VERBATIM
还有里面的样板文件Unicode::GCString
我正在使用 PAR::Packer 模块创建使用 Unicode::GCString
模块的 Perl 脚本的 Windows 可执行文件。
脚本的精简版本如下:
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);
当我运行
perl mwe.pl
输出给出字符串的'width':
11
符合预期。
我使用命令
创建mwe.exe
pp -o mwe.exe mwe.pl
当我 运行
mwe.exe
我收到错误
Can't locate object method "new" via package "Unicode::GCString" at script/mwe.pl line 6
查看 AppData\Local\Temp\par-xxxxxx\cache-xxxxx\inc\lib
后,我相信 Unicode::GCString
和 Unicode::LineBreak
一样存在。
有没有人知道如何解决这个问题?
一个解决方案是使用这个版本的 "pp" 我称之为 "ppp.pl"
$ENV{PAR_VERBATIM}=1;
system 'pp', @ARGV;
详情见 https://metacpan.org/pod/distribution/PAR/lib/PAR/Environment.pod#PAR_VERBATIM
还有里面的样板文件Unicode::GCString