}
-sub get_read_method { # DEPRECATED
+sub get_read_method {
$_[0]->{reader} || $_[0]->{accessor}
}
-sub get_write_method { # DEPRECATED
+sub get_write_method {
$_[0]->{writer} || $_[0]->{accessor}
}
my($self, $method_name) = @_;
defined($method_name)
or $self->throw_error('You must define a method name to find');
+
foreach my $class( $self->linearized_isa ){
my $method = $self->initialize($class)->get_method($method_name);
return $method if defined $method;
}
sub compute_all_applicable_attributes {
- Carp::cluck('compute_all_applicable_attributes() has been deprecated');
+ Carp::cluck('compute_all_applicable_attributes() has been deprecated')
+ if _MOUSE_VERBOSE;
return shift->get_all_attributes(@_)
}
my $check = delete $args{optimized};
if($args{_compiled_type_constraint}){
- Carp::cluck("'_compiled_type_constraint' has been deprecated, use 'optimized' instead");
- $check = $args{_compiled_type_constraint};
+ Carp::cluck("'_compiled_type_constraint' has been deprecated, use 'optimized' instead")
+ if _MOUSE_VERBOSE;
- if(blessed($check)){
- Carp::cluck("Constraint must be a CODE reference");
- $check = $check->{compiled_type_constraint};
- }
+ $check = $args{_compiled_type_constraint};
}
if($check){
)],
groups => {
default => [], # export no functions by default
+
+ # The ':meta' group is 'use metaclass' for Mouse
meta => [qw(does meta dump _MOUSE_VERBOSE)],
},
_export_to_main => 1,
}
my $role_name = $roles[-1][0];
load_class($role_name);
+
my $metarole = get_metaclass_by_name($role_name);
( $metarole && $metarole->isa('Mouse::Meta::Role') )
|| $applicant->meta->throw_error("You can only consume roles, $role_name(".$role_name->meta.") is not a Mouse role");