Hi All,
Wonder if you can help me because I'm getting bogged down with this.
I have an application written in Perl that includes several modules and they all reference a Constants.pm module for obvious reasons.
Now, I have some constants that are more complex than just a number and I've been trying to use them as hashes like:
This is so that I don't use multiple arrays that reference each other.
The problem is that I need to assign this data structure to an object attribute so I don't have to keep referencing arrays or the constants.
So, a couple of questions:
- should I be using a complex constant like this? Is there a better way? It seems too complex.
- I assume I need to pass a reference to the structure to the object attirbute. I haven't figured out how to reference a reference to a constant hash yet??!! Any ideas?
Does this make sense?
Thanks for any help,
rotis23
Wonder if you can help me because I'm getting bogged down with this.
I have an application written in Perl that includes several modules and they all reference a Constants.pm module for obvious reasons.
Now, I have some constants that are more complex than just a number and I've been trying to use them as hashes like:
Code:
use constant RESULT_STRUCTURE => {
VALUE => 10,
MORE_DATA => "Human readable data.",
};
This is so that I don't use multiple arrays that reference each other.
The problem is that I need to assign this data structure to an object attribute so I don't have to keep referencing arrays or the constants.
So, a couple of questions:
- should I be using a complex constant like this? Is there a better way? It seems too complex.
- I assume I need to pass a reference to the structure to the object attirbute. I haven't figured out how to reference a reference to a constant hash yet??!! Any ideas?
Does this make sense?
Thanks for any help,
rotis23