one more fix for unoptimized constraints
[gitmo/Moose.git] / 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" '