sub _delegate { # this is not a complete method. It's just here for illustration my ($self, $slot, $object) { $self->{$slot}{object} = $object; my @missing; foreach my $method (@{$self->{$slot}{methods}}) { push @missing => $method unless UNIVERSAL::can($object, $method); } die "Interface required @missing" if @missing; return $self; }