Commits

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

Converted _father from an ::internal method to a $self->_father($current)
method.

  • Participants
  • Parent commits 2199dc0

Comments (0)

Files changed (2)

File lib/File/Find/Object.pm

 
 sub _father
 {
-    my $self = shift;
-    if (!defined($self->{idx}))
+    my ($self, $current) = @_;
+
+    if (!defined($current->{idx}))
     {
         return undef;
     }
-    elsif ($self->{idx} >= 1)
+    elsif ($current->{idx} >= 1)
     {
-        return $self->_top->_dir_stack()->[$self->{idx}-1];
+        return $self->_dir_stack()->[$current->{idx}-1];
     }
     else
     {
-        return $self->_top();
+        return $self;
     }
 }
 
 {
     my $self = shift;
     if ($self->_current->{currentfile} = 
-        shift(@{$self->_current->_father->{_files}})
+        shift(@{$self->_father($self->_current)->{_files}})
        )
     {
         $self->_current->{_action} = {};
         return 1;
     }
 
-    $self->become_default($current->_father());
+    $self->become_default($self->_father($current));
     return 0;
 }
 
     {
         return 0;
     }
-    if ($st[0] != $current->_father->{dev} && $current->_top->{nocrossfs})
+    if ($st[0] != $self->_father($current)->{dev} && $current->_top->{nocrossfs})
     {
         return 0;
     }
     my $ptr = $current; my $rc;
-    while($ptr->_father) {
-        if($ptr->_father->{inode} == $st[1] && $ptr->_father->{dev} == $st[0]) {
+    while($self->_father($ptr)) {
+        if($self->_father($ptr)->{inode} == $st[1] && $self->_father($ptr) == $st[0]) {
             $rc = 1;
             last;
         }
-        $ptr = $ptr->_father;
+        $ptr = $self->_father($ptr);
     }
     if ($rc) {
-        printf(STDERR "Avoid loop " . $ptr->_father->{dir} . " => %s\n",
+        printf(STDERR "Avoid loop " . $self->_father($ptr)->{dir} . " => %s\n",
             $self->current_path($current));
         return 0;
     }
         return $self->{currentfile};
     }
 
-    my $p = $current->_father->{dir};
+    my $p = $self->_father($current)->{dir};
     $p =~ s!/+$!!; #!
     $p .= '/' . $current->{currentfile};
 

File lib/File/Find/Object/internal.pm

 
     $from->{dir} = $self->{dir};
 
-    return $self->_father->open_dir ? $self : undef;
+    return $top->_father($self)->open_dir ? $self : undef;
 }
 
 #sub DESTROY {