Lee Goddard said:
(e-mail address removed)-berlin.de (Anno Siegel) wrote in message
From what I understand, it impliments object fields using arrays, so
could never support what I'm after, as below:
Thanks, Anno: that's the only thing I'm not after, which is basic
implimentation instantiating the fields with given perl types, either
^^^^^^^^^^
"Perl types" is not a recognized part of Perl terminology. My question
is what you mean by it, but instead of explaining you use it as if it
*was* an explanation.
scalars or references. Instances of objects would be nice, too, but
not something I need today.
Oh man... Now which is what you want and which is what you don't want?
I tried declaring my own global fields hash and instantiating objects
from it, but of course, setting a field to instantiate to an anonymous
hash/array is setting the field in every instance of the object to
refer to the same anonymous hash/array.
Again you're using undefined terms as if they had a definite meaning.
What is "setting a field to instantiate to (something)"? I don't have
the slightest idea what you might have done. Show some code instead
of using undefined terms to explain another undefined terms.
Same hash/array: That would depend on how you do it. If you create a
new hash each time, you'll have different hashes. If you take a
reference to the same hash each time, they'll all point to the same one.
So I wrote the necessary code to get around this (check type of ref,
create new anon thingy), but it seems so necessary that I thought
there might be a pragma for it.
Why do you think this so necessary? I have rarely felt the need to
check object fields for their content. If I do, I put a check in the
accessor for that field and that's it. Nor is it necessary to preset
a field that is going to hold an array (say) to an arrayref. Leave the
field unspecified, then autovivification will initialize it to the
right thing on first access.
I don't think we're getting anywhere this way. Show some code that
demonstrates what you want to do. If there's a popular module or
pragma that does something similar, people will know and tell you.
Anno