my $self = shift;
if (@_) {
- Mouse::load_class($_) for @_;
+ foreach my $super(@_){
+ Mouse::Util::load_class($super);
+ my $meta = Mouse::Util::get_metaclass_by_name($super);
+ if($meta && $meta->isa('Mouse::Meta::Role')){
+ $self->throw_error("You cannot inherit from a Mouse Role ($super)");
+ }
+ }
@{ $self->{superclasses} } = @_;
}
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(@_)
}
: ref($default) eq 'CODE' ? $object->$default()
: $default;
- # XXX: we cannot use $attribute->set_value() because it invokes triggers.
$object->{$key} = $attribute->_coerce_and_verify($value, $object);;
weaken($object->{$key})
$impl = sub {
my ( $self, $type, $name, $code ) = @_;
my $into = $self->name;
- $install_modifier->(
- $into,
- $type,
- $name,
- $code
- );
+ $install_modifier->($into, $type, $name, $code);
+
$self->add_method($name => do{
no strict 'refs';
\&{ $into . '::' . $name };
|| $self->throw_error("You must supply a role name to look for");
for my $class ($self->linearized_isa) {
- my $meta = Mouse::Util::get_metaclass_by_name($class);
- next unless $meta && $meta->can('roles');
+ my $meta = Mouse::Util::get_metaclass_by_name($class)
+ or next;
for my $role (@{ $meta->roles }) {
}
1;
-
__END__
=head1 NAME