I have a Moose object module that should accept a relatively large data structure (ds) as one of its constructor arguments. It is used to calculate some of the object’s attributes. However, I do not wish to store ds itself as an attributes — it is only needed during the construction of the object.
I thought of using BUILDARGS but then I’m not sure how to define that ds is a required argument.
How can I work around this?
I’d be inclined to have a constructor that takes only the calculated values derived from your data structure. Then use a different method to take limited params plus the data structure as args.
Then make your objects like so:
Now you don’t have to worry about weird serialization issues or BUILDARGS or even BUILD. You have a simple method and that is all.