title: How to check if directory is writeable by UID?
body: <p>Can <code>File::Find::Rule</code> be used to determine if a directory is writeable by a given UID?</p>
  
  <p>I have used the following test:</p>
  
  <pre><code>my $uid = 123; # or whatever...
  
  my @subDirs = File::Find::Rule-&gt;permissions(isWriteable =&gt; 1, user =&gt; "$uid")-&gt;directory()-&gt;maxdepth(1)-&gt;in( $dir );
  if (scalar @subDirs == 0) {
      die "$dir is not writeable...";
  }
  die "$dir is writeable";
  </code></pre>
  
  <p>But it always returns that the <code>$dir</code> is writeable, even for test directories that I know are restricted.</p>
  
  <p>What adjustments can I make to this test to make it work?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Using <code>use File::Find::Rule qw(permissions)</code> caused the script to crash. I have not ever needed to specify this option with previous usages of <code>permissions()</code> in older <code>File::Find::Rule</code> operations.</p>
  
  <p>If I adjust the rule as follows, I get things working. </p>
  
  <p>Here, I am testing for the presence of the parent directory in the subdirectory list:</p>
  
  <pre><code>my @subDirs = File::Find::Rule::Permissions-&gt;directory()-&gt;permissions(isWriteable =&gt; 1, user =&gt; "$uid")-&gt;maxdepth(1)-&gt;name(".")-&gt;in("$dir");
  </code></pre>
  
  <p>The parent directory of the subdirectories of <code>$dir</code> is <code>.</code>  </p>
  
  <p>And if that directory exists in the list of <code>@subDirs</code>, it must be writable.</p>
  
  <p>Thanks to ikegami for suggesting this module.</p>