From 7254fb6a608b1f54d52572a859356236d0a0ba2e Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 21 Feb 2011 12:47:26 -0600 Subject: ensure we always inherit from Bread::Board::Container --- lib/MooseX/Bread/Board/Meta/Role/Class.pm | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib') diff --git a/lib/MooseX/Bread/Board/Meta/Role/Class.pm b/lib/MooseX/Bread/Board/Meta/Role/Class.pm index 9cabd88..47c34bd 100644 --- a/lib/MooseX/Bread/Board/Meta/Role/Class.pm +++ b/lib/MooseX/Bread/Board/Meta/Role/Class.pm @@ -31,6 +31,17 @@ sub get_all_services { $self->linearized_isa; } +before superclasses => sub { + my $self = shift; + + return unless @_; + return if any { $_->isa('Bread::Board::Container') } @_; + + die "Cannot inherit from " . join(', ', @_) + . " because MooseX::Bread::Board classes must inherit" + . " from Bread::Board::Container"; +}; + no Moose::Role; 1; -- cgit v1.2.3-54-g00ecf