我一直在使用pp
https://metacpan.org/pod/pp
不久前!
然而,当雇佣另一个主机时,当我运行pp命令时,脚本不会在服务器上运行
CentOS Linux 7.9.2009版(核心版(Perl 5.32.1版
命令使用pp,主机旧
$ 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
时,它运行正常。
有什么建议吗?
name.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版本中正常工作
您需要将文件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/
-
将文件添加到档案
$ pp -x -c -a lib/Mojo/resources/html_entities.txt name.pl