Commits

Anonymous committed 48da242

Extracted the _should_scan_dir method.

Comments (0)

Files changed (2)

lib/File/Find/Object.pm

 
     my $current = $self->_current();
 
-    if (defined($current->_last_dir_scanned()) &&
-        ($current->_last_dir_scanned() eq $current->_dir_as_string()
-       )
-    )
+    if (!$current->_should_scan_dir())
     {
         return $current->_open_dir_ret();
     }
 
-    $current->_last_dir_scanned($current->_dir_as_string());
-
     my $handle;
     my @files;
     if (!opendir($handle, $current->_dir_as_string()))

lib/File/Find/Object/Base.pm

     return;
 }
 
+sub _should_scan_dir
+{
+    my $self = shift;
+
+    if (defined($self->_last_dir_scanned()) &&
+        ($self->_last_dir_scanned() eq $self->_dir_as_string()
+       )
+    )
+    {
+        return;
+    }
+    else
+    {
+        $self->_last_dir_scanned($self->_dir_as_string());
+        return 1;
+    }
+}
+
 1;
 
 =head1 NAME