adding more tests to the binary tree recipe, and adding the RoleName type constraint
[gitmo/Moose.git] / lib / Moose / Util / TypeConstraints / OptimizedConstraints.pm
index 9fafbf4..38022ec 100644 (file)
@@ -5,7 +5,7 @@ use warnings;
 
 use Scalar::Util 'blessed', 'looks_like_number';
 
-our $VERSION   = '0.55_04';
+our $VERSION   = '0.69';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
@@ -60,6 +60,11 @@ sub ClassName {
     return 0;
 }
 
+sub RoleName {
+    ClassName($_[0]) 
+        && (($_[0]->can('meta') || return)->($_[0]) || return)->isa('Moose::Meta::Role')
+}
+
 # NOTE:
 # we have XS versions too, ...
 # 04:09 <@konobi> nothingmuch: konobi.co.uk/code/utilsxs.tar.gz
@@ -85,35 +90,35 @@ no user serviceable parts inside.
 
 =over 4
 
-=item Value
+=item C<Value>
 
-=item Ref
+=item C<Ref>
 
-=item Str
+=item C<Str>
 
-=item Num
+=item C<Num>
 
-=item Int
+=item C<Int>
 
-=item ScalarRef
+=item C<ScalarRef>
 
-=item ArrayRef
+=item C<ArrayRef>
 
-=item HashRef
+=item C<HashRef>
 
-=item CodeRef
+=item C<CodeRef>
 
-=item RegexpRef
+=item C<RegexpRef>
 
-=item GlobRef
+=item C<GlobRef>
 
-=item FileHandle
+=item C<FileHandle>
 
-=item Object
+=item C<Object>
 
-=item Role
+=item C<Role>
 
-=item ClassName
+=item C<ClassName>
 
 =back
 
@@ -129,7 +134,7 @@ Yuval Kogman E<lt>nothingmuch@cpan.orgE<gt>
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright 2007-2008 by Infinity Interactive, Inc.
+Copyright 2007-2009 by Infinity Interactive, Inc.
 
 L<http://www.iinteractive.com>