From: Scott McWhirter Date: Wed, 20 Feb 2008 03:45:40 +0000 (+0000) Subject: Update non-XS optimized constraints to use their XS partners X-Git-Tag: 0_55~297 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5892c70c75a80e9d5a311a337848e20764d4998c;p=gitmo%2FMoose.git Update non-XS optimized constraints to use their XS partners --- diff --git a/lib/Moose/Util/TypeConstraints/OptimizedConstraints.pm b/lib/Moose/Util/TypeConstraints/OptimizedConstraints.pm index 0356f20..cde58f5 100644 --- a/lib/Moose/Util/TypeConstraints/OptimizedConstraints.pm +++ b/lib/Moose/Util/TypeConstraints/OptimizedConstraints.pm @@ -13,13 +13,13 @@ use XSLoader; XSLoader::load('Moose', '0.39'); # This is a pain... must use the version number of moose # but can't refer to it since Moose may not be loaded. -sub Num { !ref($_[0]) && looks_like_number($_[0]) } +sub Num { !Ref($_[0]) && looks_like_number($_[0]) } -sub Int { defined($_[0]) && !ref($_[0]) && $_[0] =~ /^-?[0-9]+$/ } +sub Int { Defined($_[0]) && !Ref($_[0]) && $_[0] =~ /^-?[0-9]+$/ } -sub FileHandle { ref($_[0]) eq 'GLOB' && Scalar::Util::openhandle($_[0]) or blessed($_[0]) && $_[0]->isa("IO::Handle") } +sub FileHandle { GlobRef($_[0]) && Scalar::Util::openhandle($_[0]) or ObjectOfType($_[0], "IO::Handle") } -sub Role { blessed($_[0]) && $_[0]->can('does') } +sub Role { Object($_[0]) && $_[0]->can('does') } 1;