On Sat, Jul 4, 2009 at 12:41 AM, Hans Dieter Pearcey<h...@pobox.com> wrote: > On Sat, Jul 04, 2009 at 12:31:35AM +0100, Mark Morgan wrote: > package My::Meta::Attribute::Trait::Highlander; > use Moose::Role; > before attach_to_class => sub { > my ($self, $metaclass) = @_; > my ($existing) = grep { > $_->does(__PACKAGE__) > } $metaclass->get_all_attributes; > die "Can't add another highlander to " > . $metaclass->name > . " (found " . $existing->name . ")" > if $existing; > }; > > Untested, but you should be able to tweak this if it doesn't work right away.
Cheers for that, was exactly what I needed. :) Mark.