Commits

Anonymous committed 16d9c48

Added ::Result->is_link().

  • Participants
  • Parent commits 37db517

Comments (0)

Files changed (4)

         - http://en.wikipedia.org/wiki/Schlemiel_the_painter%27s_Algorithm
     - Added the ->is_file() method to ::Result.
     - Converted ::Result->is_dir() to use -d _ 
+    - Added ::Result->is_link().
 
 0.2.0 - Sun Feb 22 11:52:06 IST 2009
     - Optimization: now not checking for the existence of the callback() after 

lib/File/Find/Object.pm

         stat_ret => scalar($self->_top_stat_copy()),
         is_file => scalar(-f _),
         is_dir => scalar(-d _),
+        is_link => $self->_top_is_link(),
     };
 
     if ($self->_curr_not_a_dir())

lib/File/Find/Object/Result.pm

         basename
         is_dir
         is_file
+        is_link
         path
         dir_components
         stat_ret
 Returns true if the result refers to a plain file (equivalent to the Perl
 C<-f> operator).
 
+=head2 $result->is_link()
+
+Returns true if the result is a symbolic link.
+
 =head2 $result->dir_components()
 
 The components of the directory part of the path starting from base() 
 use strict;
 use warnings;
 
-use Test::More tests => 44;
+use Test::More tests => 46;
 
 BEGIN
 {
         ok ($r->is_dir(), "Is a directory");
 
         # TEST
+        ok (!$r->is_link(), "Not a link");
+
+        # TEST
         is_deeply ($r->full_components(), [], "Full components are empty");
     }
 
         ok (!$r->is_dir(), "Not a directory");
 
         # TEST
+        ok (!$r->is_link(), "Not a link");
+
+        # TEST
         is_deeply ($r->full_components(), [qw(b.doc)], 
             "Full components are 'b.doc'"
         );