Commits

Anonymous committed 927909a

Started merging F-F-O and F-F-O-i.

Comments (0)

Files changed (2)

lib/File/Find/Object.pm

 }
 
 sub isdot {
-    0;
+    my ($self) = @_;
+    if ($self->{currentfile} eq '..' || $self->{currentfile} eq '.') {
+        return 1;
+    }
+    return 0;
 }
 
 sub filter {
     $self->{currentfile};
 }
 
+sub open_dir {
+    my ($self) = @_;
+    opendir(my $handle, $self->{dir}) or return undef;
+    $self->{_files} =
+        [ sort { $a cmp $b } File::Spec->no_upwards(readdir($handle)) ];
+    closedir($handle);
+    my @st = stat($self->{dir});
+    $self->{inode} = $st[1];
+    $self->{dev} = $st[0];
+    return 1;
+}
+
 1
 
 __END__

lib/File/Find/Object/internal.pm

 
     bless($self, $class);
 
-    return $self->open_dir ? $self : undef;
+    $from->{dir} = $self->{dir};
+
+    return $self->{_father}->open_dir ? $self : undef;
 }
 
 #sub DESTROY {
 #    my ($self) = @_;
 #}
 
-sub open_dir {
-    my ($self) = @_;
-    opendir(my $handle, $self->{dir}) or return undef;
-    $self->{_files} =
-        [ sort { $a cmp $b } File::Spec->no_upwards(readdir($handle)) ];
-    closedir($handle);
-    my @st = stat($self->{dir});
-    $self->{inode} = $st[1];
-    $self->{dev} = $st[0];
-    1
-}
 
 sub me_die {
     my ($self) = @_;
 
 sub current_path {
     my ($self) = @_;
-    my $p = $self->{dir};
+    my $p = $self->{_father}->{dir};
     $p =~ s!/+$!!; #!
     $p .= '/' . $self->{currentfile};
 }
     my @st = stat($self->current_path());
     !-d _ and return 0;
     -l $self->current_path() && !$self->_top->{followlink} and return 0;
-    $st[0] != $self->{dev} && $self->_top->{nocrossfs} and return 0;
+    $st[0] != $self->{_father}->{dev} && $self->_top->{nocrossfs} and return 0;
     my $ptr = $self; my $rc;
     while($ptr->{_father}) {
-        if($ptr->{inode} == $st[1] && $ptr->{dev} == $st[0]) {
+        if($ptr->{_father}->{inode} == $st[1] && $ptr->{_father}->{dev} == $st[0]) {
             $rc = 1;
             last;
         }
         $ptr = $ptr->{_father};
     }
     if ($rc) {
-        printf(STDERR "Avoid loop $ptr->{dir} => %s\n",
+        printf(STDERR "Avoid loop $ptr->{_father}->{dir} => %s\n",
             $self->current_path());
         return 0;
     }
 
 sub movenext {
     my ($self) = @_;
-    if ($self->{currentfile} = shift(@{$self->{_files}})) {
+    if ($self->{currentfile} = shift(@{$self->{_father}->{_files}})) {
         $self->{_action} = {};
         return 1;
     } else {
     }
 }
 
-sub isdot {
-    my ($self) = @_;
-    if ($self->{currentfile} eq '..' || $self->{currentfile} eq '.') {
-        return 1;
-    }
-    return 0;
-}
 
 1