I got a undef value. In my debugging, at first I got a Net::Douban::DESTROY for $AUTOLOAD, then It went into HTTP::Cookies and return a undef value. Dose anyone have any idea how this behaviour is caused?package Net::Douban::APIFields; use base qw/Class::Accessor/; __PACKAGE__->mk_accessors(qw/Mecha Users Subjects APIKey PrivateKey Ac +cessToken Consumer/); package Net::Douban; use base qw/Net::Douban::APIFields/; our $AUTOLOAD; sub new { balala... } sub AUTOLOAD { my $self = @_; my $name = $AUTOLOAD ; return if our $AUTOLOAD =~ /::DESTROY$/; $name =~ s/::(.*?)$/$1/g; if($name !~ /^Users|Subjects|Reviews$/){ croak "No such a method"; } if ( !$self->{"SUPER::$name"}) { $self->set( $name, "Net::Douban::$name"->new( mecha => $self->Mecha, apikey => $self->APIKey, access_token => $self->AccessToken, consumer => $self->Consumer, ) ); } return $self->{"SUPER::$name"}; } sub DESTROY {}; <code> When I tried to run this code <code> $douban = Net::Douban->new(); print Dumper $douban->Users;
In reply to strange behaviour in 'AUTOLOAD' by woosley
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |