关于AUTOLOAD的问题,情大家帮忙!!谢谢

关于AUTOLOAD的问题,情大家帮忙!!谢谢

关于AUTOLOAD的问题,情大家帮忙!!谢谢
//文件father.pm
#!/usr/bin/perl
package father;
require Exporter;

our @ISA =qw(Exporter);
our @EXPORT =qw(display aa bb);
our $VERSION=1.0;

sub new
{ my $invocant= shift;
$invocant=ref($invocant)||$invocant;
my $self={farthera=>100,fartherb=>200,@_};
return bless $self,$invocant;
}
sub display{ my $self= shift;
for my $temp(keys %$self)
{
print "$temp==>$self->{$temp}";
}
}
sub clone {
my $model = shift;
my $self = $model->new(%$model, @_);
return $self;
}
sub aa {print "this is a sub of father aa\n" ; }
sub bb {print "this is a sub of father bb\n" ;}
sub cc {print "this is a sub of father cc\n" ;}

1;
//son.pm
#! /usr/bin/perl -l
package son;
use father;
our @ISA=qw(father);

sub new
{ my $invocant= shift;

$invocant=ref($invocant)||$invocant;
my $self={sona=>300,sonb=>400,@_};
return bless $self,$invocant;
}
sub aa
{ print "this is a sub of son aa ";}

sub pri
{
for my $test (keys %{*son::})
{

print "keys=".$test."::::val==${*son::}{$test}";
}
}
sub AUTOLOAD {print "this IS SON autoload";}
1;
//测试文件
package main;
use son;
my $ison=son->new();
$ison->display();
==结果====
sonb==>400
sona==>300
this IS SON autoload
为什么在文件结束的时候执行AUTOLOAD 啊?????

no DESTROY
Perl intend to invokes $ison->DESTROY, but can't find either in the son class or in all the SUPER classes, so Perl turns to invokes $ison->AUTOLOAD for a try. define an method DESTORY for son class or father class, then Perl will be satisfied, and will stop invoking AUTOLOAD.