I'm in the process of building an object, which as one of it's accessors contains a list of other objects.
These other objects are only id/name pairs at the minute but may well grow, so I'm modelling them as proper objects from the start.
What are peoples thoughts on this as a design...
has _industries => ( is => 'rw', isa => 'HashRef[Foo::Industry]', auto_deref => 1, default => sub { {} }, clearer => 'clear_industries', traits => ['Hash'], handles => { has_industry_id => 'exists', add_industry => 'set', get_industry_for_id => 'get', industry_ids => 'keys', industries => 'values', num_industries => 'count', }, );
Clearly all the specified handles are how you'd interact with the list/hash.
I don't wanna get 3 months into using this code in various places only to realise a flaw in the design.
Any thoughts, comments, suggestions, issues?
Thanks
Cagao
In reply to Moose Design Thoughts (Traits) by Cagao
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |