my ($self, $options) = @_;
(exists $options->{isa})
|| confess "You must define a type with the Array metaclass";
-
- my $c = find_type_constraint($options->{isa}) || $options->{isa};
- ( $c && blessed($c) && $c->is_a_type_of('ArrayRef'))
+
+ my $isa = $options->{isa};
+
+ unless (blessed($isa) && $isa->isa('Moose::Meta::TypeConstraint')) {
+ $isa = find_type_constraint($isa);
+ }
+
+ ($isa->is_a_type_of('ArrayRef'))
|| confess "The type constraint for a Array ($options->{isa}) must be a subtype of ArrayRef";
}
my ($self, $options) = @_;
(exists $options->{isa})
|| confess "You must define a type with the Hash metaclass";
-
- (find_type_constraint($options->{isa})->is_a_type_of('HashRef'))
+
+ my $isa = $options->{isa};
+
+ unless (blessed($isa) && $isa->isa('Moose::Meta::TypeConstraint')) {
+ $isa = find_type_constraint($isa);
+ }
+
+ ($isa->is_a_type_of('HashRef'))
|| confess "The type constraint for a Hash ($options->{isa}) must be a subtype of HashRef";
}
(exists $options->{isa})
|| confess "You must define a type with the Counter metaclass";
- (find_type_constraint($options->{isa})->is_a_type_of('Num'))
+ my $isa = $options->{isa};
+
+ unless (blessed($isa) && $isa->isa('Moose::Meta::TypeConstraint')) {
+ $isa = find_type_constraint($isa);
+ }
+
+ ($isa->is_a_type_of('Num'))
|| confess "The type constraint for a Counter ($options->{isa}) must be a subtype of Num";
}