Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use Pod::Coverage::CountParents.

  • Loading branch information...
commit 69412de5808f9e53406188eb810bc24d33ff7842 1 parent c1a294b
Paul Johnson authored
1  MANIFEST
View
@@ -152,6 +152,7 @@ tests/Module_import.pm
tests/module_relative
tests/overloaded
tests/pod
+tests/PodMod.pm
tests/random/dir/file
tests/require
tests/skip
3  MANIFEST.SKIP
View
@@ -1,6 +1,7 @@
\.org$
\.bak$
~$
+\.orig$
^Makefile$
^Makefile\.old$
^blib
@@ -16,3 +17,5 @@ core$
.out$
lib/Devel/Cover/Inc.pm$
^Devel-Cover-
+.patch$
+.rej$
19 lib/Devel/Cover.pm
View
@@ -27,7 +27,13 @@ use Config;
use Cwd "abs_path";
use File::Spec;
-BEGIN { eval "use Pod::Coverage 0.06" } # We'll use this if it is available.
+BEGIN
+{
+ # Use Pod::Coverage if it is available.
+ eval "use Pod::Coverage 0.06";
+ # We'll prefer Pod::Coverage::CountParents
+ eval "use Pod::Coverage::CountParents";
+}
# $SIG{__DIE__} = \&Carp::confess;
@@ -46,7 +52,9 @@ my @Ignore_re; # Packages to ignore.
my @Inc_re; # Original @INC to ignore.
my @Select_re; # Packages to select.
-my $Pod = $INC{"Pod/Coverage.pm"}; # Do pod coverage.
+my $Pod = $INC{"Pod/Coverage/CountParents.pm"} ? "Pod::Coverage::CountParents" :
+ $INC{"Pod/Coverage.pm"} ? "Pod::Coverage" :
+ ""; # Type of pod coverage available.
my %Pod; # Pod coverage data.
my @Cvs; # All the Cvs we want to cover.
@@ -1061,7 +1069,7 @@ sub get_cover
}
}
# use Data::Dumper; print Dumper \%opts;
- if ($Pod{$file} ||= Pod::Coverage->new(package => $pkg, %opts))
+ if ($Pod{$file} ||= $Pod->new(package => $pkg, %opts))
{
my $covered;
for ($Pod{$file}->covered)
@@ -1146,8 +1154,9 @@ reported. Statement coverage data should be reasonable, although there may be
some statements which are not reported. Branch and condition coverage data
should be mostly accurate too, although not always what one might initially
expect. Subroutine coverage should be as accurate as statement coverage. Pod
-coverage comes from L<Pod::Coverage>. Coverage data for path coverage are not
-yet collected.
+coverage comes from L<Pod::Coverage>. If L<Pod::Coverage::CountParents> is
+available it will be used instead. Coverage data for path coverage are not yet
+collected.
The F<gcov2perl> program can be used to convert gcov files to
C<Devel::Cover> databases.
28 test_output/cover/pod.5.006001
View
@@ -5,8 +5,9 @@ Reading database from /home/pjcj/g/perl/Devel-Cover/cover_db
File pod total
--------------------------------------------------------------- ------ ------
tests/Module1.pm 33.3 33.3
+tests/PodMod.pm 66.7 66.7
tests/pod n/a n/a
-Total 33.3 33.3
+Total 50.0 50.0
--------------------------------------------------------------- ------ ------
@@ -60,6 +61,29 @@ line err pod code
39 __END__
+tests/PodMod.pm
+
+line err pod code
+1 # Copyright 2005, Paul Johnson (pjcj@cpan.org)
+2
+3 # This software is free. It is licensed under the same terms as Perl itself.
+4
+5 # The latest version of this software should be available from my homepage:
+6 # http://www.pjcj.net
+7
+8 package PodMod;
+9
+10 use base "Module1";
+11
+12 1 sub vv { die }
+13 *** 0 sub ww { die }
+14 1 sub yy { die }
+15
+16 1
+17
+18 __END__
+
+
tests/pod
line err pod code
@@ -79,7 +103,7 @@ line err pod code
14
15 use lib "tests";
16
-17 use Module1;
+17 use PodMod;
18
19 my @x;
20
2  tests/pod
View
@@ -14,7 +14,7 @@ use warnings;
use lib "tests";
-use Module1;
+use PodMod;
my @x;
Please sign in to comment.
Something went wrong with that request. Please try again.