Commits

Anonymous committed 05745f9

Eliminated the F-F-O-i is-a F-F-O relationship.

  • Participants
  • Parent commits 812630f

Comments (0)

Files changed (2)

lib/File/Find/Object.pm

 
     return $p;
 }
-
 sub open_dir {
-    my ($self) = @_;
-    opendir(my $handle, $self->{dir}) or return undef;
-    $self->{_files} =
+    my ($self, $current) = @_;
+    opendir(my $handle, $current->{dir}) or return undef;
+    $current->{_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];
+    my @st = stat($current->{dir});
+    $current->{inode} = $st[1];
+    $current->{dev} = $st[0];
     return 1;
 }
 

lib/File/Find/Object/internal.pm

 use strict;
 use warnings;
 
-use vars qw(@ISA);
-@ISA = qw(File::Find::Object);
+use File::Spec;
+sub _curr_file
+{
+    my $self = shift;
 
-use File::Spec;
+    if (@_)
+    {
+        $self->{_curr_file} = shift;
+    }
+
+    return $self->{_curr_file};
+}
 
 sub new {
     my ($class, $top, $from, $index) = @_;
 
     $from->{dir} = $self->{dir};
 
-    return $top->_father($self)->open_dir ? $self : undef;
+    return $top->open_dir($top->_father($self)) ? $self : undef;
 }
 
+
 1;