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;
centos6.5:/root/testperl#cat test.pl
unshift(@INC,"/root/testperl");
use Pkg01 ;
my $ua=Pkg01->new();
print $ua->sum_all(1,5,8);
print "
";
centos6.5:/root/testperl#/usr/local/perl/bin/pp -g -o testperl test.pl
centos6.5:/root/testperl#
centos6.5:/root/testperl#cp testperl /tmp/
centos6.5:/root/testperl#./testperl
80
修改下:
return ($self->{a} + $self->{b} + $self->{c} + $c + $d + $e + 1);
centos6.5:/root/testperl#perl test.pl
81
centos6.5:/root/testperl#./testperl
80
程序需要重新打包;
centos6.5:/root/testperl#./testperl
80
centos6.5:/root/testperl#/usr/local/perl/bin/pp -g -o testperl test.pl
centos6.5:/root/testperl#./testperl
81