2 package Moose::Policy::SingleInheritence;
4 use constant metaclass => 'Moose::Policy::SingleInheritence::MetaClass';
6 package Moose::Policy::SingleInheritence::MetaClass;
9 extends 'Moose::Meta::Class';
11 before 'superclasses' => sub {
12 my ($self, @superclasses) = @_;
13 confess 'Moose::Policy::SingleInheritence in effect for ' .
14 $self->name . ', only single inheritence is allowed'
15 if scalar @superclasses > 1;
26 Moose::Policy::SingleInheritence - Why would you ever need more than one?
32 use Moose::Policy 'Moose::Policy::SingleInheritence';
37 use Moose::Policy 'Moose::Policy::SingleInheritence';
42 use Moose::Policy 'Moose::Policy::SingleInheritence';
45 extends 'Foo', 'Bar'; # BOOM!!!!
49 This module restricts Moose's C<extends> keyword so that you can only assign
52 This is mostly an example of how you can restrict behavior with meta-policies
53 in addition to extending and/or customising them. However, sometimes enforcing
54 a policy like this can be a good thing.
58 All complex software has bugs lurking in it, and this module is no
59 exception. If you find a bug please either email me, or add the bug
64 Stevan Little E<lt>stevan@iinteractive.comE<gt>
66 =head1 COPYRIGHT AND LICENSE
68 Copyright 2006 by Infinity Interactive, Inc.
70 L<http://www.iinteractive.com>
72 This library is free software; you can redistribute it and/or modify
73 it under the same terms as Perl itself.