sub factory { my $self = shift; ... my $newInstance = new Bar(...); ... return $newInstance; }