Commits

shl...@6f433eb9-a002-0410-945b-ee5462c261ee  committed 1972731

Refactoring - extracted some methods.

  • Participants
  • Parent commits 5f7424c

Comments (0)

Files changed (1)

File lib/File/Find/Object.pm

     return ! @{$self->_dir_stack()};
 }
 
+sub _curr_mode {
+    return shift->_top_stat->[2];
+}
+
+sub _curr_not_a_dir {
+    return !S_ISDIR( shift->_curr_mode() );
+}
+
 sub _current_path
 {
     my $self = shift;
     my $base = shift(@$components);
     my $stat = $self->_top_stat_copy();
 
-    my @basename = ();
     my $path = $self->_current_path();
 
-    if (! S_ISDIR($stat->[2]))
+    my @basename = ();
+    if ($self->_curr_not_a_dir())
     {
         @basename = (basename => pop(@$components));
     }
         $self->_stat_ret($self->_top_stat_copy());
     }
 
-    if (! S_ISDIR($self->_top_stat->[2]))
+    if ($self->_curr_not_a_dir())
     {
         return 0;
     }
 sub _non_top__check_subdir_helper {
     my $self = shift;
 
-    if (S_ISLNK($self->_top_stat->[2]) && !$self->followlink())
+    if (S_ISLNK($self->_curr_mode()) && !$self->followlink())
     {
         return 0;
     }