Hash of References in an Objectby pboin (Deacon)
|on May 26, 2005 at 13:21 UTC||Need Help??|
pboin has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to stretch the head a bit and advance through the next plateau, but as you know, that's not always easy. I have a module (Product::Datafile) that creates an object. That datafile object in turn has ten or so objects of type (Cobol::Copybook).
My low-tech way, which seems valid was have a new entry in the hash containing a reference for each copybook. That's a legit thing to do I believe:
Now, striving to 'think right', I realized that I can't be Lazy and loop through these copy books 'cause they're not in a data structure like they should be. My 'loop' would have to be hard-coded, and edited whenever a new copybook comes online.
So, I want to have a hash keyed on name, with values being references to copybook objects. I know it's the old HofH trick but I'm on a bit of sensory overload with the extra dynamics of OO code and I just can't see clearly. Here's what I tried:
That looks right to my not-so-confident eye, but my pal Data::Dumper gives:
The references are all borken, and I *know* things aren't correct, espeically with the cross-references between '00', '01', and '04'. Seeing the bless() is kinda weird too, right?
PS: I'd appreciate better title suggestions. Please /msg me with suggestions if you have one.