X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMouse%2FTypeRegistry.pm;h=c5ce7ed133e53ad537d59718dac8246025ec51d6;hb=6cbacbf68a2e6c28c8a41ae5322e614485b22aeb;hp=4f3125cc92462261975ea9c898da2ab7cc6446c4;hpb=0f636a977c023ab857c525f6e4eed7e4881d0e26;p=gitmo%2FMouse.git diff --git a/lib/Mouse/TypeRegistry.pm b/lib/Mouse/TypeRegistry.pm index 4f3125c..c5ce7ed 100644 --- a/lib/Mouse/TypeRegistry.pm +++ b/lib/Mouse/TypeRegistry.pm @@ -18,7 +18,7 @@ sub optimized_constraints { Num => sub { !ref($_) && looks_like_number($_) }, Int => sub { defined($_) && !ref($_) && /^-?[0-9]+$/ }, Str => sub { defined($_) && !ref($_) }, - ClassName => sub { 1 }, + ClassName => sub { Mouse::is_class_loaded($_) }, Ref => sub { ref($_) }, ScalarRef => sub { ref($_) eq 'SCALAR' }, @@ -42,3 +42,18 @@ sub optimized_constraints { 1; +__END__ + +=head1 NAME + +Mouse::TypeRegistry - simple type constraints + +=head1 METHODS + +=head2 optimized_constraints -> HashRef[CODE] + +Returns the simple type constraints that Mouse understands. + +=cut + +