in reply to Re^2: displaying package variable from inherited method.
in thread displaying package variable from inherited method.
my $data = { one => 1, two => 2 }; sub data { return $data; }
I don't know how you'd use tie() to get the original code to work. If you really want that construct, you'll need to use symbolic references or - even more dangerous - eval.
Also note that even if it would work as you expected, the original code will break as soon as someone subclasses Child.
update: in the example you posted here, there's no need to do
You can just callmy $proto = ref $self; print $proto->data;
print $self->data;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: displaying package variable from inherited method.
by wazoox (Prior) on Jun 10, 2006 at 15:21 UTC |