[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Writable file test broken?



On Tue, 29 Sep 1998 07:46:09 -0400, Chris Nandor wrote:

>At 23.51 -0400 1998.09.28, Mat Marcus wrote:
>>When I use the '-w' file test on a soft-locked file I get back 'true'. What
>>is the recommended way to test mac file writability?
>
>  if (open(FILE, ">$file")) {
>     # $file is writable :)
>  }

You're kidding, right? 

This will not only test if the file is writeable, but will destroy it in
the process, too.

The next variant is safer:

  if (open(FILE, ">>$file")) { ... }

and I hope it works, too.

	Bart.

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch