I have a module that I'm working on. I am setting up a few attributes like this:
$self->{FOO};
$self->{BAR};
$self->{FOOBAR};
And, I want to use AUTOLOAD to help create methods for accessing these attributes. For example, $foo->Bar()
returns the value of $self->{BAR}
. No problem. Everything is standard.
Now, I want to create alias Methods. For example, if someone says $obj->Fu();
, I'll return $self->{FOO}
. What I'd like to do is create a $self->{FU}
that points to the same memory location as $self->{FOO}
. That way, when I set the value of $self->{FOO}
, $self-{FU}
is also set. This way, I don't have to make all sorts of changes in the way AUTOLOAD works or remember to set $self->{FU}
whenever I set $self->{FOO}
.
Any easy way of doing this?