in reply to How to store objects as arrays in other objects
First, best is subjective, especially in perl.
One popular framework for OOP in perl is Moose. It will handle basic functional stuff so you can concentrate on structure more than ground-level functions. Also see Moose::Intro and Moose::Cookbook for the how-to. Based on the apparent simplicity of what you want to do, it would seem a good choice.
In terms of what you have, I would avoid using explicit hash references to pass data to your objects. If an object has sufficiently complex structure to justify that, you really ought to be adding children to handle the data and appropriate accessors there. This follows the OOP ideal that all objects without children should be simple. The extra complexity is demonstrated by the fact that you need to pass a hash reference to your set routine.
|
|---|