From: gfx Date: Tue, 2 Mar 2010 09:32:13 +0000 (+0900) Subject: Work around RT #55048 for Mouse::PurePerl X-Git-Tag: 0.50_06~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1adf864effeeff1cfdbe79f6014a483860e2ec3f;p=gitmo%2FMouse.git Work around RT #55048 for Mouse::PurePerl --- diff --git a/lib/Mouse/PurePerl.pm b/lib/Mouse/PurePerl.pm index bdd6661..3c7fbd8 100644 --- a/lib/Mouse/PurePerl.pm +++ b/lib/Mouse/PurePerl.pm @@ -145,8 +145,16 @@ sub Bool { $_[0] ? $_[0] eq '1' : 1 } sub Undef { !defined($_[0]) } sub Defined { defined($_[0]) } sub Value { defined($_[0]) && !ref($_[0]) } -sub Num { !ref($_[0]) && looks_like_number($_[0]) } -sub Int { defined($_[0]) && !ref($_[0]) && $_[0] =~ /^-?[0-9]+$/ } +sub Num { looks_like_number($_[0]) } +sub Int { + my($value) = @_; + looks_like_number($value) && do{ + # work around RT #55048 + # This is for more than 32 bit int on 32 bit systems + require POSIX; + POSIX::fmod($value, 1) == 0; + }; +} sub Str { my($value) = @_; return defined($value) && ref(\$value) eq 'SCALAR';