I'm new to OO in Perl. I have a class that I have created. In this class, I need an attribute that is a hash whose members contain an array.
I have gotten the hash to work, but making the contents of the hash an array is a mystery to me.
I'm wondering if I need another class that this class will have as an attribute?
sub new { my $class = shift; my $self = { coreID => 0, isBpMaskError => 0, isVrrpErrors => 0, isSymPriorityErrors => 0, isSslProfileErrors => 0, isGlobalPortErrors => 0, isVipsinVipGroupsErrors => 0, isVipGroupErrors => 0, isSnatIpErrors => 0, isCodeVersionErrors => 0, aclsMissingFromMaster => {}, }; bless $self, $class; return $self; }
I want the aclsMissingFromMaster hash to contain an array. Should I just make a class ACLS with attributes being arrays and make that class object an attribute of this class? Or is there a way to make the above class contain a hash containing arrays.
eg: I am trying to make the following hash an attribute of the above class.
%hash1{'list1'}-> [1,2,3,4] %hash1{'list2'}-> [4,5,6,7] ...
Thanks for your wisdom!
In reply to OO Design Question with Hashes of Arrays by ahackney
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |