in reply to How to test if a file is readable on Win64?

eval the test:
eval {-r "$File1"}; if ($@) { $Debug && print "File $File1 is not readable! Return was $@.\n"; return 1; }

Replies are listed 'Best First'.
Re^2: How to test if a file is readable on Win64?
by rhardy (Acolyte) on Mar 10, 2014 at 23:52 UTC
    I'm puzzled. Why would an eval make any difference?

      No, eval wouldn't make any difference

      If the -r test is causing the popup Win32API::File::SetErrorMode(2); should silence it

      It's my understanding that wrapping code in an eval will effectively fork and return the result code, setting $@ on an error. It should sidestep the crash nicely allowing for the catch that the OP appears to be digging for.

      That said, I could be answering the wrong question.

        eval never forks
        eval cannot trap win32 messageboxes (popups)
        win32 messageboxes (popups) are generated by msvs c-runtime ... they are not the result of die