Type constraints to the rescue

has 'config' => (
   is  => 'ro',
   isa => 'HashRef',
);

Class->new(config => 'foo'); 
Attribute (config) does not pass the type constraint because: 
  Validation failed for 'HashRef' failed with value 'foo'