perl 打包成PAR包 类似JAR包

来源:互联网 发布:好听的爱情句子知乎 编辑:程序博客网 时间:2024/06/12 11:51
PP 命令的使用:PP来生成PAR文件(相当于JAVA的JAR文件,可用RAR打开来查看),PAR里包含了可运行脚本及其依赖,然后用PARL来运行PAR里的可运行 脚本:方法一:"pp -p -B -I ./src -o ./ebnms.par ./test/test_svr/start_svr.pl ./src/scp.pl"会生成par的压缩包 通过  perl安装目录/bin/parl xxx.par 运行centos6.5:/root/testperl#/usr/local/perl/bin/pp -p -B -o test.par test.pl -p 生成PAR-g 生成二进制程序-B 将各种依赖项打进去-I 加入到@INC-o 生成的文件名centos6.5:/root/testperl#cat Pkg01.pm package Pkg01;sub new{    my $class = shift;    my $self={              'a'=>11,              'b'=>22,               'c'=>33             };    bless $self,$class;    return $self;            };sub sum_all {    my $self=shift;    my ($c,$d,$e)=@_;     return ($self->{a} + $self->{b} + $self->{c} + $c + $d + $e + 1);  };1;centos6.5:/root/testperl#cat test.plunshift(@INC,"/root/testperl");   use Pkg01 ;  my $ua=Pkg01->new();print $ua->sum_all(1,5,8);print "\n";centos6.5:/root/testperl#/usr/local/perl/bin/pp -p -B -o test.par test.pl centos6.5:/root/testperl#/usr/local/perl/bin/parl test.par 81修改Pkg01:     return ($self->{a} + $self->{b} + $self->{c} + $c + $d + $e + 2);  };  centos6.5:/root/testperl#/usr/local/perl/bin/parl test.par 81centos6.5:/root/testperl#perl test.pl82修改包内的函数后,需要重新打成PAR文件类似的 JAVA程序里,如果.java里的函数修改,所有引用这个函数的jar包,都需要重新打。

0 0
原创粉丝点击