At 02:47 PM 8/9/01 -0700, Sara Taillon wrote:
>You can use stat as others recommended, but stat can be expensive.  Stat
>is good for getting all permissions, but if you just want to see if you
>can write, execute or read a file, try using the file test operators.
>For example, to see if a file is writable:
>
>if (-w $filename) { ... }

Uh, that -w is going to result in a stat() anyway, so if by 'expensive' 
you're talking about run-time performance, it won't make any 
difference.  More readable, perhaps.  But there again, -w isn't guaranteed 
to return the right answer (if, say, you're on a filesystem using 
ACLs).  Doing an open with mode ">>" is a better guide.
--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to