package Foo; our %Foo= ( _text => 'some text', ... }; sub _classobj { my $self = shift || __PACKAGE__; my $class = ref($self) || $self; no strict "refs"; return \%$class; } for my $datum (keys %{ _classobj() } ) { *$datum = sub { my $self = shift; $self = $self->_classobj() unless ref $self; $self->{$datum} = shift if @_; return $self->{$datum}; } } package Bar; @ISA = qw("Foo"); our %Bar= ( _text => 'some other text', _also => 'also this one', ... }; sub _classobj { my $self = shift || __PACKAGE__; my $class = ref($self) || $self; no strict "refs"; return \%$class; } for my $datum (keys %{ _classobj() } ) { *$datum = sub { my $self = shift; $self = $self->_classobj() unless ref $self; $self->{$datum} = shift if @_; return $self->{$datum}; } }