Commits

Anonymous committed 6ef5fc3

Kwalitee: added t/pod.t and t/pod-coverage.t and made sure the module
has full POD coverage.

Comments (0)

Files changed (5)

 t/05prune.t
 t/lib/File/Find/Object/TreeCreate.pm
 t/sample-data/h.txt
+t/pod.t
+t/pod-coverage.t

lib/File/Find/Object.pm

     my $self = {};
     bless $self, $class;
 
-    $self->dir($top->current_path($from));
+    $self->dir($top->_current_path($from));
     $self->idx($index);
 
     $self->_last_dir_scanned(undef);
 
     $from->dir($self->dir());
 
-    return $top->open_dir($top->_father($self)) ? $self : undef;
+    return $top->_open_dir($top->_father($self)) ? $self : undef;
 }
 
 package File::Find::Object;
         my $current = $self->_current();
         if ($self->_process_current($current))
         {
-            return $self->item($self->current_path($current));
+            return $self->item($self->_current_path($current));
         }
         $current = $self->_current();
-        if(!$self->movenext) {
-            if ($self->me_die($current))
+        if(!$self->_movenext) {
+            if ($self->_me_die($current))
             {
                 return $self->item(undef);
             }
     1;
 }
 
-sub movenext {
+sub _movenext {
     my ($self) = @_;
     if (@{$self->_dir_stack()})
     {
     }
 }
 
-sub me_die {
-    if (@_ != 2)
-    {
-        confess "Hello";
-    }
+sub _me_die {
     my ($self, $current) = @_;
 
     if ($self eq $current)
         return 1;
     }
 
-    $self->become_default($self->_father($current));
+    $self->_become_default($self->_father($current));
     return 0;
 }
 
-sub become_default
+sub _become_default
 {
     my ($self, $current) = @_;
 
    
     $current->_curr_file() or return 0;
 
-    $self->isdot($current) and return 0;
     $self->_filter_wrapper($current) or return 0;  
 
     foreach my $action ($self->depth() ? qw(b a) : qw(a b))
         $current->_action->{$action} = 1;
         if($action eq 'a') {
             if ($self->callback()) {
-                $self->callback()->($self->current_path($current));
+                $self->callback()->($self->_current_path($current));
             }
             return 1;
         }
 {
     my ($self, $current) = @_;
 
-    $self->check_subdir($current) or 
+    $self->_check_subdir($current) or 
         return "SKIP";
 
 
     return 0;
 }
 
-sub isdot
-{
-    my ($self, $current) = @_;
-
-    my $file = $current->_curr_file();
-
-    return ($file eq ".." || $file eq ".");
-}
-
 sub _filter_wrapper {
     my ($self, $current) = @_;
     return defined($self->filter()) ?
-        $self->filter()->($self->current_path($current)) :
+        $self->filter()->($self->_current_path($current)) :
         1;
 }
 
-sub check_subdir 
+sub _check_subdir 
 {
     my ($self, $current) = @_;
 
     {
         return 1;
     }
-    my @st = stat($self->current_path($current));
+    my @st = stat($self->_current_path($current));
     if (!-d _)
     {
         return 0;
     }
-    if (-l $self->current_path($current) && !$self->followlink())
+    if (-l $self->_current_path($current) && !$self->followlink())
     {
         return 0;
     }
     }
     if ($rc) {
         printf(STDERR "Avoid loop " . $self->_father($ptr)->dir() . " => %s\n",
-            $self->current_path($current));
+            $self->_current_path($current));
         return 0;
     }
     return 1;
 }
 
-sub current_path {
+sub _current_path {
     my ($self, $current) = @_;
 
     if ($self eq $current)
     return File::Spec->catfile($p, $current->_curr_file);
 }
 
-sub open_dir {
+sub _open_dir {
     my ($self, $current) = @_;
 
     if (defined($current->_last_dir_scanned()) &&
     # Remming out because it doesn't work.
     # $self->_father($self->_current)->dir($self->_current->dir());
 
-    $self->_current->dir($self->current_path($self->_current()));
+    $self->_current->dir($self->_current_path($self->_current()));
 
-    # open_dir can return undef if $self->_current is not a directory.
-    if ($self->open_dir($self->_current))
+    # _open_dir can return undef if $self->_current is not a directory.
+    if ($self->_open_dir($self->_current))
     {
         return [ @{$self->_current->_files()}];
     }

lib/File/Find/Object/Base.pm

-# $Id: Object.pm 73 2006-09-03 20:14:23Z shlomif $
-
-#- Olivier Thauvin <olivier.thauvin@aerov.jussieu.fr>
-
 # This program is free software, distributed under the same terms as 
 # Parrot.
 
 
 1;
 
+=head1 NAME
+
+File::Find::Object::Base - base class for File::Find::Object
+
+=head2 DESCRIPTION
+
+This is the base class for F::F::O classes. It only defines some accessors,
+and is for File::Find::Object's internal use.
+
+=head1 SEE ALSO
+
+L<File::Find::Object>
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod::Coverage 1.04";
+plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@;
+all_pod_coverage_ok();
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod 1.14";
+plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
+all_pod_files_ok();