sub _get_restricted_class {
my ($self, $type, $target) = @_;
my $r_class = join('::', $target, '__RestrictedWithObject');
- unless (eval { $r_class->can('can') }) {
- my $r_comp = join(
- '::', 'DBIx::Class::Schema::RestrictWithObject::RestrictComp', $type
- );
+ my $r_comp = join(
+ '::', 'DBIx::Class::Schema::RestrictWithObject::RestrictComp', $type
+ );
+ unless ($r_class->isa($r_comp)) {
$self->inject_base($r_class, $r_comp, $target);
}
return $r_class;