in reply to Re^2: delegate Moose accessors to a HASH?
in thread delegate Moose accessors to a HASH?
Sorry, I wrote it as a getter, not an accessor.
handles => { this => sub { @_ == 1 ? $_[0]->data->{this} : $_[0]->data->{this} = $_[1] }, that => sub { @_ == 1 ? $_[0]->data->{that} : $_[0]->data->{that} = $_[1] }, },
You can use a map to avoid duplication and/or an accessor generating function.
|
|---|