Closed hakonhagland closed 3 years ago
Is this a bug, or is it expected behavior?
Both :smile: PAR::Packer
uses Module::ScanDeps
to determine what to pack. In general, Module::ScanDeps
only considers Perl source files, i.e. anything acquired via use
, require
or do
. Even that may fail, e.g. if the require
target is not a literal string, but evaluated at runtime. That's why there's pp -x ...
where we look into %INC
after the script has been run to find out what was actually loaded. Unfortunately, there's no standard Perl mechanism how to acquire non-Perl "resource" files (so every CPAN distribution rolls their own) and also no registry like %INC
.
Module::ScanDeps
has builtin rules for some well known modules to pack their resource files, e.g. the Unicode tables in the Perl core. I just added a rule for the above file. You may retry packing your script after installing Module::ScanDeps
from HEAD.
Hello,
apache@node68196 ~/webroot $ cpan -D Module::ScanDeps
Reading '/var/www/.cpan/Metadata'
Database was generated on Thu, 13 May 2021 18:29:02 GMT
Module::ScanDeps
-------------------------------------------------------------------------
(no description)
R/RS/RSCHUPP/Module-ScanDeps-1.31.tar.gz
/usr/lib/perl5/site_perl/5.32.1/Module/ScanDeps.pm
Installed: 1.31
CPAN: 1.31 up to date
Roderich Schupp (RSCHUPP)
rschupp@cpan.org
The module was already installed and even then the error still persists.
apache@node68196 ~/webroot $ pp -x -c test.pl
/tmp/I3_yViYEbt syntax OK
apache@node68196 ~/webroot $ ./a.out
Unable to open html entities file (/tmp/par-617061636865/cache-2326ec06084336d46204f7cef6395a20a23dbd89/inc/lib/Mojo/resources/html_entities.txt): No such file or directory at script/test.pl line 8.
Compilation failed in require at script/test.pl line 8.
BEGIN failed--compilation aborted at script/test.pl line 8.
You may retry packing your script after installing Module::ScanDeps from HEAD.
...not from CPAN, but from its GitHub repo HEAD, e.g.
cpanm git://github.com/rschupp/Module-ScanDeps.git
Perfect!
It worked 100%, it solved the problem.
Thank you so much!
Thanks for confirmation!
Hi. Consider this script:
if I pack this script with:
and then run the generated executable (Ubuntu 21.04, perl version 5.32.0):
See this question on stackoverflow.com for more information.
The problem seems to be that the file
Mojo/resources/html_entities.txt
was not included in the archive. Is this a bug, or is it expected behavior?