f 怎麼把你的perl script 在RH 7.6 打包成執行檔, port 到其他主機上執行 ~ 迪貝之家

Pages

怎麼把你的perl script 在RH 7.6 打包成執行檔, port 到其他主機上執行

這是PAR::Packer的功能
要先安裝ExtUtils::Embed
得透過yum 安裝
我不曉得為何cpanm無法安裝
它會把perl 的source拉回來
yum install perl-ExtUtils-Embed
然後安裝PAR::Packer
 cpanm PAR::Packer

開始打包
pp -g -B -I /usr/local/lib64/perl5 -I /usr/local/share/perl5 -o ./log3 ./log3.pl

這是output
# Use of runtime loader module Module::Runtime detected.  Results of static scanning may be incomplete.
# Use of runtime loader module Module::Implementation detected.  Results of static scanning may be incomplete.

直接在本機執行log3 這隻程式的結果
./log3 36
low limit time : 2019-06-25 05:38:03
Jun 26 2019 07:59:00:110AMspid56The error log has been reinitialized. See the previous log for older entries.

Jun 26 2019 07:59:00:110AMspid56The error log has been reinitialized. See the previous log for older entries.
Jun 26 2019 07:59:00:100AMspid56The error log has been reinitialized. See the previous log for older entries.
Jun 26 2019 07:59:00:090AMspid56The error log has been reinitialized. See the previous log for older entries.
Jun 26 2019 07:59:00:090AMspid56The error log has been reinitialized. See the previous log for older entries.
Jun 26 2019 07:59:00:080AMspid56The error log has been reinitialized. See the previous log for older entries.
Jun 26 2019 07:59:00:070AMspid56The error log has been reinitialized. See the previous log for older entries.
Jun 26 2019 07:59:00:060AMspid56The error log has been reinitialized. See the previous log for older entries.
Jun 26 2019 07:59:00:060AMspid56The error log has been reinitialized. See the previous log for older entries.
Jun 26 2019 07:59:00:050AMspid56The error log has been reinitialized. See the previous log for older entries.
Jun 26 2019 07:59:00:040AMspid56The error log has been reinitialized. See the previous log for older entries.
Jun 26 2019 07:59:00:040AMspid56The error log has been reinitialized. See the previous log for older entries.
Jun 26 2019 07:59:00:030AMspid56The error log has been reinitialized. See the previous log for older entries.
Jun 26 2019 07:59:00:020AMspid56The error log has been reinitialized. See the previous log for older entries.
Jun 26 2019 07:59:00:010AMspid56The error log has been reinitialized. See the previous log for older entries.
Jun 25 2019 07:59:00:010AMspid56The error log has been reinitialized. See the previous log for older entries.
Jun 26 2019 02:00:01:780AMspid55DBCC CHECKDB (msdb) WITH all_errormsgs, no_infomsgs, tableresults executed by NT AUTHORITY\SYSTEM found 0 errors and repaired 0 errors. Elapsed time: 0 hours 0 minutes 1 seconds.  Internal database snapshot has split point LSN = 00000792:00000ab0:0001 and first LSN = 00000792:00000aae:0001.
Jun 26 2019 02:00:01:970AMspid55DBCC CHECKDB (master) WITH all_errormsgs, no_infomsgs, tableresults executed by NT AUTHORITY\SYSTEM found 0 errors and repaired 0 errors. Elapsed time: 0 hours 0 minutes 0 seconds.  Internal database snapshot has split point LSN = 000000f6:00000027:0001 and first LSN = 000000f6:00000025:0001.
Jun 26 2019 02:00:02:280AMspid55DBCC CHECKDB (mssqlsystemresource) WITH all_errormsgs, no_infomsgs, tableresults executed by NT AUTHORITY\SYSTEM found 0 errors and repaired 0 errors. Elapsed time: 0 hours 0 minutes 0 seconds.
Jun 26 2019 02:00:02:500AMspid55DBCC CHECKDB (model) WITH all_errormsgs, no_infomsgs, tableresults executed by NT AUTHORITY\SYSTEM found 0 errors and repaired 0 errors. Elapsed time: 0 hours 0 minutes 0 seconds.  Internal database snapshot has split point LSN = 00000053:00000538:0001 and first LSN = 00000053:00000536:0001.
Jun 26 2019 02:00:03:320AMspid55DBCC CHECKDB (rdsadmin) WITH all_errormsgs, no_infomsgs, tableresults executed by NT AUTHORITY\SYSTEM found 0 errors and repaired 0 errors. Elapsed time: 0 hours 0 minutes 0 seconds.  Internal database snapshot has split point LSN = 000002a3:0000030f:0001 and first LSN = 000002a3:0000030d:0001.

把 log3 binary 及/usr/local/lib64/perl5, /usr/local/share/perl5, /usr/local/freetds 
一併拷貝到另一台主機,執行結果如下 :
[root@ip-10-120-26- ~]# ls log3
log3
[root@ip-10-120-26-~]# pwd
/root
[root@ip-10-120-26-~]# ./log3 36
low limit time : 2019-06-25 05:36:17
Jun 26 2019 07:59:00:110AMspid56The error log has been reinitialized. See the previous log for older entries.

Jun 26 2019 07:59:00:110AMspid56The error log has been reinitialized. See the previous log for older entries.
Jun 26 2019 07:59:00:100AMspid56The error log has been reinitialized. See the previous log for older entries.
Jun 26 2019 07:59:00:090AMspid56The error log has been reinitialized. See the previous log for older entries.
Jun 26 2019 07:59:00:090AMspid56The error log has been reinitialized. See the previous log for older entries.
Jun 26 2019 07:59:00:080AMspid56The error log has been reinitialized. See the previous log for older entries.
Jun 26 2019 07:59:00:070AMspid56The error log has been reinitialized. See the previous log for older entries.
Jun 26 2019 07:59:00:060AMspid56The error log has been reinitialized. See the previous log for older entries.
Jun 26 2019 07:59:00:060AMspid56The error log has been reinitialized. See the previous log for older entries.
Jun 26 2019 07:59:00:050AMspid56The error log has been reinitialized. See the previous log for older entries.
Jun 26 2019 07:59:00:040AMspid56The error log has been reinitialized. See the previous log for older entries.
Jun 26 2019 07:59:00:040AMspid56The error log has been reinitialized. See the previous log for older entries.
Jun 26 2019 07:59:00:030AMspid56The error log has been reinitialized. See the previous log for older entries.
Jun 26 2019 07:59:00:020AMspid56The error log has been reinitialized. See the previous log for older entries.
Jun 26 2019 07:59:00:010AMspid56The error log has been reinitialized. See the previous log for older entries.
Jun 25 2019 07:59:00:010AMspid56The error log has been reinitialized. See the previous log for older entries.
Jun 26 2019 02:00:01:780AMspid55DBCC CHECKDB (msdb) WITH all_errormsgs, no_infomsgs, tableresults executed by NT AUTHORITY\SYSTEM found 0 errors and repaired 0 errors. Elapsed time: 0 hours 0 minutes 1 seconds.  Internal database snapshot has split point LSN = 00000792:00000ab0:0001 and first LSN = 00000792:00000aae:0001.
Jun 26 2019 02:00:01:970AMspid55DBCC CHECKDB (master) WITH all_errormsgs, no_infomsgs, tableresults executed by NT AUTHORITY\SYSTEM found 0 errors and repaired 0 errors. Elapsed time: 0 hours 0 minutes 0 seconds.  Internal database snapshot has split point LSN = 000000f6:00000027:0001 and first LSN = 000000f6:00000025:0001.
Jun 26 2019 02:00:02:280AMspid55DBCC CHECKDB (mssqlsystemresource) WITH all_errormsgs, no_infomsgs, tableresults executed by NT AUTHORITY\SYSTEM found 0 errors and repaired 0 errors. Elapsed time: 0 hours 0 minutes 0 seconds.
Jun 26 2019 02:00:02:500AMspid55DBCC CHECKDB (model) WITH all_errormsgs, no_infomsgs, tableresults executed by NT AUTHORITY\SYSTEM found 0 errors and repaired 0 errors. Elapsed time: 0 hours 0 minutes 0 seconds.  Internal database snapshot has split point LSN = 00000053:00000538:0001 and first LSN = 00000053:00000536:0001.
Jun 26 2019 02:00:03:320AMspid55DBCC CHECKDB (rdsadmin) WITH all_errormsgs, no_infomsgs, tableresults executed by NT AUTHORITY\SYSTEM found 0 errors and repaired 0 errors. Elapsed time: 0 hours 0 minutes 0 seconds.  Internal database snapshot has split point LSN = 000002a3:0000030f:0001 and first LSN = 000002a3:0000030d:0001.