Commits

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

Created an accessor for ->{ind} which is now target_index().

  • Participants
  • Parent commits b72b770

Comments (0)

Files changed (1)

File lib/File/Find/Object.pm

 __PACKAGE__->mk_accessors(qw(
     _dir_stack
     _targets
+    _target_index
 ));
 
 sub _get_options_ids
 
     my $tree = {
         
-        ind => -1,
-        
         _dir_stack => [],
     };
 
         $tree->set($opt, $options->{$opt});
     }
     $tree->_targets([ @targets ]);
+    $tree->_target_index(-1);
 
     return $tree;
 }
     }
 }
 
+sub _increment_target_index
+{
+    my $self = shift;
+    $self->_target_index(
+        $self->_target_index() + 1
+    );
+}
+
 sub _movenext_wo_current
 {
     my $self = shift;
 
-    $self->{ind} > @{$self->_targets()} and return;
-    $self->{ind}++;
-    $self->_curr_file($self->_targets()->[$self->{ind}]);
+    if ($self->_target_index() > @{$self->_targets()})
+    {
+        return 0;
+    }
+    $self->_increment_target_index();
+
+    $self->_curr_file($self->_targets()->[$self->_target_index()]);
     $self->_action({});
     1;
 }