* role exclusion and aliasiing now works in composite roles too
[gitmo/Moose.git] / lib / Moose / Util / TypeConstraints.pm
index 5af8dc5..9ebc42f 100644 (file)
@@ -8,7 +8,7 @@ use Carp         'confess';
 use Scalar::Util 'blessed', 'reftype';
 use Sub::Exporter;
 
-our $VERSION   = '0.19';
+our $VERSION   = '0.20';
 our $AUTHORITY = 'cpan:STEVAN';
 
 ## --------------------------------------------------------
@@ -98,8 +98,8 @@ sub export_type_constraints_as_functions {
     my $pkg = caller();
     no strict 'refs';
     foreach my $constraint (keys %{$REGISTRY->type_constraints}) {
-        *{"${pkg}::${constraint}"} = $REGISTRY->get_type_constraint($constraint)
-                                              ->_compiled_type_constraint;
+        my $tc = $REGISTRY->get_type_constraint($constraint)->_compiled_type_constraint;
+        *{"${pkg}::${constraint}"} = sub { $tc->($_[0]) ? 1 : undef };
     }
 }