one more fix for unoptimized constraints
Jesse Luehrs [Thu, 21 Apr 2011 06:03:39 +0000 (01:03 -0500)]
lib/Moose/Util/TypeConstraints/Builtins.pm

index 0b28d49..ad6e1f5 100644 (file)
@@ -102,7 +102,8 @@ sub define_builtins {
     subtype 'FileHandle'
         => as 'Ref'
         => where {
-            Scalar::Util::openhandle($_) || ( blessed($_) && $_->isa("IO::Handle") );
+            (ref($_) eq "GLOB" && Scalar::Util::openhandle($_))
+         || (blessed($_) && $_->isa("IO::Handle"));
         }
         => inline_as {
             '(ref(' . $_[1] . ') eq "GLOB" '