version 0.01
[gitmo/Moose-Policy.git] / lib / Moose / Policy / SingleInheritence.pm
CommitLineData
461dc6d3 1
2package Moose::Policy::SingleInheritence;
3
4use constant metaclass => 'Moose::Policy::SingleInheritence::MetaClass';
5
6package Moose::Policy::SingleInheritence::MetaClass;
7use Moose;
8
9extends 'Moose::Meta::Class';
10
11before '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;
16};
17
181;
19
20__END__
21
22=pod
23
09eff61e 24=head1 NAME
25
26Moose::Policy::SingleInheritence - Why would you ever need more than one?
27
28=head1 SYNOPSIS
29
30 package Foo;
31
32 use Moose::Policy 'Moose::Policy::SingleInheritence';
33 use Moose;
34
35 package Bar;
36
37 use Moose::Policy 'Moose::Policy::SingleInheritence';
38 use Moose;
39
40 package Foo::Bar;
41
42 use Moose::Policy 'Moose::Policy::SingleInheritence';
43 use Moose;
44
45 extends 'Foo', 'Bar'; # BOOM!!!!
46
47=head1 DESCRIPTION
48
49This module restricts Moose's C<extends> keyword so that you can only assign
50a single superclass.
51
52This is mostly an example of how you can restrict behavior with meta-policies
53in addition to extending and/or customising them. However, sometimes enforcing
54a policy like this can be a good thing.
55
56=head1 BUGS
57
58All complex software has bugs lurking in it, and this module is no
59exception. If you find a bug please either email me, or add the bug
60to cpan-RT.
61
62=head1 AUTHOR
63
64Stevan Little E<lt>stevan@iinteractive.comE<gt>
65
66=head1 COPYRIGHT AND LICENSE
67
68Copyright 2006 by Infinity Interactive, Inc.
69
70L<http://www.iinteractive.com>
71
72This library is free software; you can redistribute it and/or modify
73it under the same terms as Perl itself.
74
461dc6d3 75=cut