my $pkg_defined_in = scalar( caller(1) );
if (my $type = $REGISTRY->get_type_constraint($class)) {
- _confess(
- "The type constraint '$class' has already been created in "
- . $type->_package_defined_in
- . " and cannot be created again in "
- . $pkg_defined_in )
+ if (!($type->isa('Moose::Meta::TypeConstraint::Class') && $type->class eq $class)) {
+ _confess(
+ "The type constraint '$class' has already been created in "
+ . $type->_package_defined_in
+ . " and cannot be created again in "
+ . $pkg_defined_in )
+ }
}
my %options = (
my $pkg_defined_in = scalar( caller(1) );
if (my $type = $REGISTRY->get_type_constraint($role)) {
- _confess(
- "The type constraint '$role' has already been created in "
- . $type->_package_defined_in
- . " and cannot be created again in "
- . $pkg_defined_in )
+ if (!($type->isa('Moose::Meta::TypeConstraint::Role') && $type->role eq $role)) {
+ _confess(
+ "The type constraint '$role' has already been created in "
+ . $type->_package_defined_in
+ . " and cannot be created again in "
+ . $pkg_defined_in )
+ }
}
my %options = (