in reply to Re^4: Modifying/extending a superclass' data
in thread Modifying/extending a superclass' data
Oh! I wasn't clear that you controlled both. You could do a form of protected access that returns a reference to the structure. (Breaking encapsulation in a limited way).
# in MathML::Entities my %ENTITIES; sub _get_entity_hash { my $caller = caller; if ( $caller->isa("MathML::Entities") ) { return \%ENTITIES; } else { die "_get_entity_hash can't be called from $caller" } }
-xdg
Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Modifying/extending a superclass' data
by kiz (Monk) on Nov 17, 2005 at 15:40 UTC |