has alarmMailsTo => ( traits => ['ConfigEmail'], # trait for type "email" conf_key => 'ALARM_MAILS_TO' # associate with a config key isa => 'ArrayRef[Str]', is => 'rw', ); #### .. with My::Config; ## some runtime information, eventually for the trait's method has validDomain => ( isa => 'Str', is => 'rw', ); has alarmMailsTo => ( traits => ['ConfigEmail'], conf_key => 'ALARM_MAILS_TO' attr_valid_domain => 'validDomain' ## give attr name to trait isa => 'ArrayRef[Str]', is => 'rw', ); .. #### .. role My::Config { method load() { .. ## $attr is a Moose::Meta::Attribute $attr->parse($self, $configString); .. } .. } #### .. role My::Config::ConfigEmail { has attr_valid_domain => ( isa => 'Str', is => 'rw', required => 1, ); method parse($instance!, $value!) { .. $instance ->meta ->find_attribute_by_name($self->attr_valid_domain) ->get_value($instance); .. } .. }