【问题标题】:Perl PAR PP - Don't work /tmp/par-726f6f74/inc/lib/Mojo/resources/html_entities.txtPerl PAR PP - 不工作 /tmp/par-726f6f74/inc/lib/Mojo/resources/html_entities.txt
【发布时间】:2021-08-01 07:29:18
【问题描述】:

我一直在用pp

https://metacpan.org/pod/pp

不久前!

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

CentOS Linux 版本 7.9.2009(核心) Perl v 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 时,它运行正常。

有什么建议吗?

名称.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 版本中正常工作

【问题讨论】:

  • use lib ("$Bin") 是什么意思?您是否在本地安装了模块?
  • 我可以在 Ubuntu 21.04、perl 版本 5.32 上重现此错误,here 是产生错误的最小版本
  • 模块是使用 ROOT 安装的 sudo cpan Mojo 我刚刚创建了文件夹:./Mojo/resources/ 包含文件:html_entities.txt
  • 已添加bug report

标签: perl mojo perl-packager


【解决方案1】:

您需要将文件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
    

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-06-15
  • 2015-05-27
  • 1970-01-01
相关资源
最近更新 更多