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

Re: [MacPerl] Re: Writable file test broken?



At 13.32 -0400 1998.09.29, Mat Marcus wrote:
>Stewart Leicester wrote:
>>>So why doesn't -w work?
>
>Chris Nandor wrote:
>>I dunno.  But I never use it, as I consider it Not The Best Way.  What do
>>you want to do with the file?  If you want to open the file for writing,
>>just do it and check the return value.  There is not much reason to make it
>>a two-step process, usually.  First, one step is faster than two; second,
>>something could conceivably happen in between the time you check its
>>writability and the time you open it, so it is less reliable.
>
>I do not wish to write (or destroy!) anything. We are using a
>source-control system which soft-locks files which are not checked out. It
>does not make use of 'ckid' resources. There are a number of scripts I
>would like to write in perl to automate my workflow. A simple example would
>be to list all files which I have checked out. I would like this to run as
>fast as possible.

So you want to see if a file is locked without opening it and checking the
return value?  Well, as suggested before, you could open(FILE, ">>$file")
or $fileislocked++ ... as long as you don't write to FILE, $file should
remain unchanged.

I tried to find a way to check if a file is locked, but I couldn't.  The
nameLocked flag in fdFlags is not the same thing, apparently.

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

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