are generated against classes.
RETVAL
bool
+ObjectOfType(value, class)
+ SV* value
+ SV* class
+ PREINIT:
+ const char* classname;
+ CODE:
+ RETVAL = 0;
+
+ classname = SvPV_nolen(class);
+ if(!classname){
+ RETVAL = 0;
+ }
+
+ if( ck_sv_is_ref(value)
+ && sv_isobject(value)
+ && sv_derived_from(value, classname)
+ ){
+ RETVAL = 1;
+ }
+ OUTPUT:
+ RETVAL
+
+bool
RegexpRef(value)
SV* value
CODE:
sub hand_optimized_type_constraint {
my $self = shift;
my $class = $self->name;
- sub { blessed( $_[0] ) && $_[0]->isa($class) }
+ sub {
+ Moose::Util::TypeConstraints::OptimizedConstraints::ObjectOfType($_[0], $class)
+ }
}
sub has_hand_optimized_type_constraint { 1 }
=item Object
+=item ObjectOfType
+
+Makes sure $object->isa($class). Used in anon type constraints.
+
=item Role
=back