Commits

Anonymous committed b450ca2

Refactoring - prepended _ to accessors and extracted a method.

  • Participants
  • Parent commits fc5a791

Comments (0)

Files changed (2)

lib/File/Find/Object.pm

     {
         return 0;
     }
-    if ($st->[0] != $self->_current_father->dev() && $self->nocrossfs())
+    if ($st->[0] != $self->_current_father->_dev() && $self->nocrossfs())
     {
         return 0;
     }
     my $ptr = $current; my $rc;
     while($self->_father($ptr)) {
-        if($self->_father($ptr)->inode() == $st->[1] && $self->_father($ptr) == $st->[0]) {
+        if ($self->_father($ptr)->_is_same_inode($st)) {
             $rc = 1;
             last;
         }
     );
     
     my @st = stat($current->_dir_as_string());
-    $current->inode($st[1]);
-    $current->dev($st[0]);
+    $current->_inode($st[1]);
+    $current->_dev($st[0]);
 
     return $current->_open_dir_ret(1);
 }

lib/File/Find/Object/Base.pm

 __PACKAGE__->mk_accessors(qw(
     _actions
     _curr_file
-    dev
+    _dev
     _dir
     _files
     idx
-    inode
+    _inode
     _last_dir_scanned
     _open_dir_ret
     _traverse_to
     return File::Spec->catdir(@{$self->_dir()});
 }
 
+sub _is_same_inode
+{
+    my $self = shift;
+    # $st is an array ref with the return of perldoc -f stat .
+    my $st = shift;
+
+    return ($self->_dev() == $st->[0] && $self->_inode() == $st->[1]);
+}
+
 1;
 
 =head1 NAME