将Perl脚本转换为可执行文件包装由perl脚本

时间:2017-02-02 12:33:26

标签: perl

我有一个小的perl脚本 test.pl 。这个perl脚本使用输入作为YAML文件 database.yml 要将这些perl脚本转换为可执行文件,请运行以下命令。

pp -o -x teste.exe test.pl

它创建可执行文件,但是当我尝试运行此可执行文件时,它会抛出在该目录中找不到database.yml文件的错误。

如何在创建perl脚本的exe时确保可执行文件包含YAML文件?

注意: - 我在Unix中使用perl verison 5.8。

1 个答案:

答案 0 :(得分:0)

使用-a开关:

pp -a database.yml -o -x teste.exe test.pl

来自pp文档:

   -a, --addfile=FILE|DIR
       Add an extra file into the package.  If the file is a directory, recursively add all files inside that directory, with links turned into actual files.

       By default, files are placed under "/" inside the package with their original names.  You may override this by appending the target filename after a ";", like this:

           % pp -a "old_filename.txt;new_filename.txt"
           % pp -a "old_dirname;new_dirname"

       You may specify "-a" multiple times.