package tree; has '_branches' => ( traits => ['Hash'], is => 'rw', isa => 'HashRef[Any]', handles => { _set_branch => 'set', _is_branch => 'defined', _list_branches => 'keys', _branch => 'get' }, trigger => sub { my($self,$hash) = @_; $self->_build_branch($hash); } ); sub _build_branch{ my($self,$hash); # do stuff! #return altered or coerced hash return $hash; } #### LinkedList{} LinkedList.append() LinkedList.insert() LinkedList.size() LinkedList.has_children() LinkedList.remove() LinkedList.split() #### package Bucket; has '_linkedlist' => ( traits => ['LinkedList'], is => 'rw', isa => 'LinkedListRef[Any]', handles => { _add_link => 'append', _insert_link => 'insert', _count_links => 'size', _del_link => 'remove', _split_at_link => 'split', _has_sublinks => 'has_children', } };