Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: How to test if a file is readable on Win64?

by jellisii2 (Hermit)
on Mar 10, 2014 at 14:48 UTC ( [id://1077696]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1077696]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2024-04-20 00:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found