if ref($instance->{$key}) && $attribute->is_weak_ref;
if ($attribute->has_trigger) {
- $attribute->trigger->($instance, $args->{$from}, $attribute);
+ $attribute->trigger->($instance, $args->{$from});
}
}
else {
Data::Dumper::Dumper $self;
}
+
+sub does {
+ my ($self, $role_name) = @_;
+ (defined $role_name)
+ || confess "You must supply a role name to does()";
+ my $meta = $self->meta;
+ foreach my $class ($meta->linearized_isa) {
+ my $m = $meta->initialize($class);
+ return 1
+ if $m->can('does_role') && $m->does_role($role_name);
+ }
+ return 0;
+};
+
1;
__END__
need to redispatch or return any specific value.
+=head2 does $role_name
+
+This will check if the invocant's class "does" a given C<$role_name>.
+This is similar to "isa" for object, but it checks the roles instead.
+
+
=head2 B<dump ($maxdepth)>
From the Moose POD: