in reply to Ironclad protection of instance data
Nothing can be truely ironclad since you are using perl and no matter what you do, someone could probably get around it (although some solutions require walking the op-tree which is just silly).
But seriously, I would have to agree with dws in that you may be restricting yourself too much. I have dealt with this issue myself in the past, and have created a module (Devel::StrictObjectHash) to solve it. I took a slightly different approach than you are suggestion, which is not to restrict access to instance data, but instead to verify that it is not accessed incorrectly.
Devel::StrictObjectHash allows you to use hash-ref based Perl OO and with a few lines of up-front configuration (and no extra code in your classes) check that your instance data is protected from misuse during development and testing. Once you are satisfied, you can remove the configuration and allow your code to run unhindered. It allows the 3 common styles of access (public, protected and private) and is flexible with hash-key naming conventions as well. If you are interested and/or have any questions let me know and I will be happy to help.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Ironclad protection of instance data
by skyknight (Hermit) on Jul 04, 2004 at 04:20 UTC | |
by BrowserUk (Patriarch) on Jul 04, 2004 at 10:21 UTC |