Commits

Anonymous committed 1972731

Refactoring - extracted some methods.

Comments (0)

Files changed (1)

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;
     }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.