in reply to Blessing subrefs
I haven't used something like that before, but I can see another way to accomplish the same thing. But I have no idea which one is the 'best'... (nor do I know if it works for the full 100%, I only did some basic testing)
Create a package to which you can tie a hash, add the restrictions/additions to in the STORE/FETCH method.
Now you could tie a hash in your new-function to that package, and return a blessed reference to the tied hash.
Now you could access the attributes as $self->{'attr'}, and the addition(s) as $self->{'rand120'} (for example ofc).
Have you considered using this/a similar technique?
(Note, I know that this wasn't your question but I thought it could be relevant/useful so I posted it...)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Blessing subrefs
by blazar (Canon) on May 20, 2005 at 19:47 UTC |