in reply to Re{2}: Idea on a Base class API
in thread Idea on a Base class API
In addition, you need to consider read-only, write-only, and completely private variables. While the latter can be hidden elsewhere, you'd need to have a way to define this.
Both are possible to include in the setup you have. The read-write-edness of the variable can be done by using arrays as the values for the attributes hash, using the second element of the array as "r", "rw", "w", or undef/0 for private variables.
The former option, I would suggest that the 'type' can be several things. If a scalar, it can either be the 7 defined perl types, or if not one of those, then a possible class name (such that the argument can be checked by an ISA relationship. If an array, then the arguement can be any one of the types or ISAs in that array. Finally, if the passed argument is a coderef, then when setting, the code should be checked to see if what is passed matches the code, else you lead to failure.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re{4}: Idea on a Base class API
by John M. Dlugosz (Monsignor) on Jun 13, 2001 at 18:44 UTC |