in reply to Checking for directory write permissions

As an alternate to using -w or stat, just try and write and handle the error. If the open returns failure check if $! == EACCESS; if it does then there was a permissions problem (presuming you've done a use POSIX qw( :errno_h ) of course).

Replies are listed 'Best First'.
Re^2: Checking for directory write permissions
by ptum (Priest) on Jun 26, 2006 at 20:10 UTC

    I think this is a better solution, or at least one that should not be overlooked. Actually trying to write the file can also expose other errors (disk full comes to mind, etc.) which may not be identified by a simple -w (especially at the directory level).


    No good deed goes unpunished. -- (attributed to) Oscar Wilde