in reply to Re: Re: Re: Whats wrong with symbol refs here?
in thread Whats wrong with symbol refs here?
This is what I was referring to in my other writeup in this thread
A real life example cut and paste from a production module :
sub AUTOLOAD { my ( $self, $arg ) = @_; no strict 'refs'; (my $method = $AUTOLOAD ) =~ s/^.*:://; if ( exists $self->{_data}->{$method} ) { *{$AUTOLOAD} = sub { my ( $self, $arg ) = @_; if ( defined $arg ) { $self->{_data}->{$method} = $arg; } return $self->{_data}->{$method}; }; } else { croak qq%Can't locate object method $method via package % . __PA +CKAGE__ ; } goto &{$AUTOLOAD}; }
/J\
|
|---|