+ # Then, try the parent constraint
+ return 1 if $tc->parent->check($thing);
+
+ # If $thing isn't even an object, don't bother trying to coerce it
+ my $class = blessed($thing);
+ return 0 unless defined $class;
+
+ # Find the file to autoload
+ my $mapper = $tc->mapper;
+ my $pm = $class = $tc->$mapper($class);
+ $pm =~ s{::}{/}g;
+ $pm .= '.pm';
+ return 0 if $INC{$pm}; # already loaded
+
+ local $@;
+ eval {
+ # We die often here, even though we're not really interested in the error.
+ # However, if a die handler is set (e.g. to \&Carp::confess), this can get
+ # very slow. Resetting the handler shows a 10% total time improvement for the
+ # geodyn app.
+ local $SIG{__DIE__};
+ require $pm;
+ };
+
+ return 0;
+}