Commit | Line | Data |
0fa70d03 |
1 | package Moose::Meta::Class::Immutable::Trait; |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use Class::MOP; |
7 | |
19a330e5 |
8 | our $VERSION = '1.03'; |
16c237c1 |
9 | $VERSION = eval $VERSION; |
10 | our $AUTHORITY = 'cpan:STEVAN'; |
11 | |
0fa70d03 |
12 | use base 'Class::MOP::Class::Immutable::Trait'; |
13 | |
d9205410 |
14 | sub add_role { $_[1]->_immutable_cannot_call } |
0fa70d03 |
15 | |
aaf4b735 |
16 | sub calculate_all_roles { |
d9205410 |
17 | my $orig = shift; |
18 | my $self = shift; |
19 | @{ $self->{__immutable}{calculate_all_roles} ||= [ $self->$orig ] }; |
aaf4b735 |
20 | } |
0fa70d03 |
21 | |
22 | 1; |
2dc27d6f |
23 | |
24 | __END__ |
25 | |
26 | =pod |
27 | |
28 | =head1 NAME |
29 | |
30 | Moose::Meta::Class::Immutable::Trait - Implements immutability for metaclass objects |
31 | |
32 | =head1 DESCRIPTION |
33 | |
34 | This class makes some Moose-specific metaclass methods immutable. This |
35 | is deep guts. |
36 | |
c5fc2c21 |
37 | =head1 BUGS |
38 | |
39 | See L<Moose/BUGS> for details on reporting bugs. |
40 | |
2dc27d6f |
41 | =head1 AUTHOR |
42 | |
43 | Yuval Kogman E<lt>nothingmuch@cpan.orgE<gt> |
44 | |
45 | =head1 COPYRIGHT AND LICENSE |
46 | |
47 | Copyright 2009 by Infinity Interactive, Inc. |
48 | |
49 | L<http://www.iinteractive.com> |
50 | |
51 | This library is free software; you can redistribute it and/or modify |
52 | it under the same terms as Perl itself. |
53 | |
54 | =cut |
55 | |