in reply to Re: file testing is hard
in thread file testing is hard

So, when I read your problem statement, I'm left with the impression that you might be working with an INI file, which you'll create if missing, update if writable, use if read-only, and ignore if none of the above. (If that's not right, feel free to take or leave the following as you see fit).

close ;) it isn't an INI file and i'm in UNIX, and i want to bail if none of the above. from reading above and the Camel, sysopen limits things sufficiently that I shall not have to test for all those various possibilities. To make sure that the $file wasn't a socket or directory or link and that the script's UID can write it ... or that the script's UID can create the file if it doesn't exist was turning into a waterfall of if elsif statements that would work, if i needed to be real specific. for example, if i needed to make sure that i'm opening up and fork, or something (i've never done that, i'm not of legal age for that sort of thing in my country) ... then i would appreciate all that precise testing. But for just opening up a file, I can rely on the fact that sysopen can't open up a directory, or a pipe (yet still allows me easy access to the resulting file's permissions). Hey, that's gravvy :)

that said, i'm still digesting the code sample and write up. Thank you so much for taking the time to explain. Thanks also to PodMaster for directing me to check out sysopen. I've learned something new :)

jamgill