Perl PAR PP - 不工作 /tmp/par-726f6f74/inc/lib/Mojo/resources/html_entities.txt

问题描述

我一直在使用 pp

https://metacpan.org/pod/pp

不久前!

然而,当我雇用另一个主机时,当我运行 pp 命令时,脚本不会在服务器上运行

CentOS Linux 7.9.2009 版(核心) Perl v 5.32.1

命令使用pp,host old

$ pp -x -c name.pl

运行时

./a.out

Unable to open html entities file (/tmp/par-726f6f74/cache-78cdefedff4d2afddea0035addc3b570c8f0bfd5/inc/lib/Mojo/resources/html_entities.txt): No such file or directory at script / name.pl line 13.
Compilation Failed in require at script / name.pl line 13.
BEGIN Failed - compilation aborted at script / name.pl line 13.

当我运行 ./name.pl 时,它运行正常。

有什么建议吗?

名称.pl

#!/usr/bin/perl

use FindBin qw($Bin);
use lib ("$Bin");

use DBI;
use Number::Format;
use Encode qw(decode encode);
use File::Basename;
use Mojo::Util qw(b64_encode b64_decode url_escape url_unescape);
use Mojo::JSON qw(decode_json encode_json);
use Image::ExifTool;
use LWP;


print "Test Mojo";

这个相同的命令在另一台服务器/主机上的 5.28 版中正常工作

解决方法

您需要将文件 True 添加到存档中。 以下似乎对我有用:

  • 找到文件的位置:

    html_entities.txt
  • 将文件复制到本地目录:

    $ perl -MMojo::Util -MFile::Basename=dirname -E '$fn = (dirname $INC{"Mojo/Util.pm"}) . "/resources/html_entities.txt"; say $fn'
    /home/hakon/perlbrew/perls/perl-5.32.0/lib/site_perl/5.32.0/Mojo/resources/html_entities.txt
    
  • 将文件添加到存档中

    $ mkdir -p ./lib/Mojo/resources/
    $ cp /home/hakon/perlbrew/perls/perl-5.32.0/lib/site_perl/5.32.0/Mojo/resources/html_entities.txt ./lib/Mojo/resources/