package Myproject::Model; use Moo; has table => (is => 'rw'); sub newtable { my ($self, $table) = @_; my $tob = Myproject::Model::Table->new( # also uses Moo and defines these ro attributes:- name => $table, model => $self, ); $self->table or $self->table({}); my $tables = $self->table; $tables -> {$table} = $tob; } 1;