1 package Moose::Meta::Class::Immutable::Trait;
7 use Scalar::Util qw( blessed );
10 $VERSION = eval $VERSION;
11 our $AUTHORITY = 'cpan:STEVAN';
13 use base 'Class::MOP::Class::Immutable::Trait';
15 sub add_role { $_[1]->_immutable_cannot_call }
17 sub calculate_all_roles {
20 @{ $self->{__immutable}{calculate_all_roles} ||= [ $self->$orig ] };
23 sub calculate_all_roles_with_inheritance {
26 @{ $self->{__immutable}{calculate_all_roles_with_inheritance} ||= [ $self->$orig ] };
35 || $self->throw_error("You must supply a role name to look for");
37 $self->{__immutable}{does_role} ||= { map { $_->name => 1 } $self->calculate_all_roles_with_inheritance };
39 my $name = blessed $role ? $role->name : $role;
41 return $self->{__immutable}{does_role}{$name};
52 Moose::Meta::Class::Immutable::Trait - Implements immutability for metaclass objects
56 This class makes some Moose-specific metaclass methods immutable. This
61 See L<Moose/BUGS> for details on reporting bugs.
65 Yuval Kogman E<lt>nothingmuch@cpan.orgE<gt>
67 =head1 COPYRIGHT AND LICENSE
69 Copyright 2009 by Infinity Interactive, Inc.
71 L<http://www.iinteractive.com>
73 This library is free software; you can redistribute it and/or modify
74 it under the same terms as Perl itself.