| 1 | package Test::Pod::Coverage; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | =head1 NAME | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | Test::Pod::Coverage - Check for pod coverage in your distribution. | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | =head1 VERSION | ||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | Version 1.10 | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | =cut | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 10 | our $VERSION = "1.10"; | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | In one of your dist's test files (eg C<t/pod-coverage.t>): | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | use Test::Pod::Coverage tests=>1; | ||||||||||||||||||||||||||||
| 20 | pod_coverage_ok( "Foo::Bar", "Foo::Bar is covered" ); | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | Test::Pod::Coverage is used to create a test for your distribution, | ||||||||||||||||||||||||||||
| 25 | to ensure that all relevant files in your distribution are appropriately | ||||||||||||||||||||||||||||
| 26 | documented in pod. | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | Can also be called with L<Pod::Coverage> parms. | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | use Test::Pod::Coverage tests=>1; | ||||||||||||||||||||||||||||
| 31 | pod_coverage_ok( | ||||||||||||||||||||||||||||
| 32 | "Foo::Bar", | ||||||||||||||||||||||||||||
| 33 | { also_private => [ qr/^[A-Z_]+$/ ], }, | ||||||||||||||||||||||||||||
| 34 | "Foo::Bar, with all-caps functions as privates", | ||||||||||||||||||||||||||||
| 35 | ); | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | The L<Pod::Coverage> parms are also useful for subclasses that don't | ||||||||||||||||||||||||||||
| 38 | re-document the parent class's methods. Here's an example from | ||||||||||||||||||||||||||||
| 39 | L<Mail::SRS>. | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | pod_coverage_ok( "Mail::SRS" ); # No exceptions | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | # Define the three overridden methods. | ||||||||||||||||||||||||||||
| 44 | my $trustme = { trustme => [qr/^(new|parse|compile)$/] }; | ||||||||||||||||||||||||||||
| 45 | pod_coverage_ok( "Mail::SRS::DB", $trustme ); | ||||||||||||||||||||||||||||
| 46 | pod_coverage_ok( "Mail::SRS::Guarded", $trustme ); | ||||||||||||||||||||||||||||
| 47 | pod_coverage_ok( "Mail::SRS::Reversable", $trustme ); | ||||||||||||||||||||||||||||
| 48 | pod_coverage_ok( "Mail::SRS::Shortcut", $trustme ); | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | Alternately, you could use L<Pod::Coverage::CountParents>, which always allows | ||||||||||||||||||||||||||||
| 51 | a subclass to reimplement its parents' methods without redocumenting them. For | ||||||||||||||||||||||||||||
| 52 | example: | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | my $trustparents = { coverage_class => 'Pod::Coverage::CountParents' }; | ||||||||||||||||||||||||||||
| 55 | pod_coverage_ok( "IO::Handle::Frayed", $trustparents ); | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | (The C<coverage_class> parameter is not passed to the coverage class with other | ||||||||||||||||||||||||||||
| 58 | parameters.) | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | If you want POD coverage for your module, but don't want to make | ||||||||||||||||||||||||||||
| 61 | Test::Pod::Coverage a prerequisite for installing, create the following | ||||||||||||||||||||||||||||
| 62 | as your F<t/pod-coverage.t> file: | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | use Test::More; | ||||||||||||||||||||||||||||
| 65 | eval "use Test::Pod::Coverage"; | ||||||||||||||||||||||||||||
| 66 | plan skip_all => "Test::Pod::Coverage required for testing pod coverage" if $@; | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | plan tests => 1; | ||||||||||||||||||||||||||||
| 69 | pod_coverage_ok( "Pod::Master::Html"); | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | Finally, Module authors can include the following in a F<t/pod-coverage.t> | ||||||||||||||||||||||||||||
| 72 | file and have C<Test::Pod::Coverage> automatically find and check all | ||||||||||||||||||||||||||||
| 73 | modules in the module distribution: | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | use Test::More; | ||||||||||||||||||||||||||||
| 76 | eval "use Test::Pod::Coverage 1.00"; | ||||||||||||||||||||||||||||
| 77 | plan skip_all => "Test::Pod::Coverage 1.00 required for testing POD coverage" if $@; | ||||||||||||||||||||||||||||
| 78 | all_pod_coverage_ok(); | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | =cut | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | 10 | ▶ | use 5.006; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 83 | 10 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 84 | 10 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | 10 | ▶ | use Pod::Coverage; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 87 | 10 | ▶ | use Test::Builder; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | 10 | my $Test = Test::Builder->new; | |||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | 10 | ▶ | sub import { | ||||||||||||||||||||||||||
|
Subroutine
import: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 92 | 10 | my $self = shift; | |||||||||||||||||||||||||||
| 93 | 10 | my $caller = caller; | |||||||||||||||||||||||||||
| 94 | 10 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 95 | 10 | *{$caller.'::pod_coverage_ok'} = \&pod_coverage_ok; | |||||||||||||||||||||||||||
| 96 | 10 | *{$caller.'::all_pod_coverage_ok'} = \&all_pod_coverage_ok; | |||||||||||||||||||||||||||
| 97 | 10 | *{$caller.'::all_modules'} = \&all_modules; | |||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | 10 | $Test->exported_to($caller); | |||||||||||||||||||||||||||
| 100 | 10 | $Test->plan(@_); | |||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | =head1 FUNCTIONS | ||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | All functions listed below are exported to the calling namespace. | ||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | =head2 all_pod_coverage_ok( [$parms, ] $msg ) | ||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | Checks that the POD code in all modules in the distro have proper POD | ||||||||||||||||||||||||||||
| 110 | coverage. | ||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | If the I<$parms> hashref if passed in, they're passed into the | ||||||||||||||||||||||||||||
| 113 | C<Pod::Coverage> object that the function uses. Check the | ||||||||||||||||||||||||||||
| 114 | L<Pod::Coverage> manual for what those can be. | ||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | The exception is the C<coverage_class> parameter, which specifies a class to | ||||||||||||||||||||||||||||
| 117 | use for coverage testing. It defaults to C<Pod::Coverage>. | ||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | =cut | ||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | 1 | ▶ | sub all_pod_coverage_ok { | ||||||||||||||||||||||||||
|
Subroutine
all_pod_coverage_ok: called CC=7 SCAR=21.8
Pod
documented
| |||||||||||||||||||||||||||||
| 122 | 1 | ▶ | my $parms = (@_ && (ref $_[0] eq "HASH")) ? shift : {}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@_ and ref $_[0] eq "HASH"
MC/DC0%0/2
@_ and ref $_[0] eq "HASH"
@_
ref $_[0] eq "HASH"
Truth table33%1/3
A and B
A= @_B= ref $_[0] eq "HASH"
| |||||||||||||||||||||||||||||
| 123 | 1 | my $msg = shift; | |||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | 1 | my $ok = 1; | |||||||||||||||||||||||||||
| 126 | 1 | my @modules = all_modules(); | |||||||||||||||||||||||||||
| 127 | 1 | ▶ | if ( @modules ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 128 | 1 | $Test->plan( tests => scalar @modules ); | |||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | 1 | for my $module ( @modules ) { | |||||||||||||||||||||||||||
| 131 | 1 | ▶ | my $thismsg = defined $msg ? $msg : "Pod coverage on $module"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | 1 | my $thisok = pod_coverage_ok( $module, $parms, $thismsg ); | |||||||||||||||||||||||||||
| 134 | 1 | ▶ | $ok = 0 unless $thisok; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||
| 137 | else { | ||||||||||||||||||||||||||||
| 138 | 0 | $Test->plan( tests => 1 ); | |||||||||||||||||||||||||||
| 139 | 0 | $Test->ok( 1, "No modules found." ); | |||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | 1 | return $ok; | |||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | =head2 pod_coverage_ok( $module, [$parms, ] $msg ) | ||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | Checks that the POD code in I<$module> has proper POD coverage. | ||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | If the I<$parms> hashref if passed in, they're passed into the | ||||||||||||||||||||||||||||
| 151 | C<Pod::Coverage> object that the function uses. Check the | ||||||||||||||||||||||||||||
| 152 | L<Pod::Coverage> manual for what those can be. | ||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | The exception is the C<coverage_class> parameter, which specifies a class to | ||||||||||||||||||||||||||||
| 155 | use for coverage testing. It defaults to C<Pod::Coverage>. | ||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||
| 157 | =cut | ||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | 13 | ▶ | sub pod_coverage_ok { | ||||||||||||||||||||||||||
|
Subroutine
pod_coverage_ok: called CC=13 SCAR=25.7
Pod
documented
| |||||||||||||||||||||||||||||
| 160 | 13 | my $module = shift; | |||||||||||||||||||||||||||
| 161 | 13 | ▶ | my %parms = (@_ && (ref $_[0] eq "HASH")) ? %{(shift)} : (); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@_ and ref $_[0] eq "HASH"
MC/DC100%2/2
@_ and ref $_[0] eq "HASH"
@_
ref $_[0] eq "HASH"
Truth table100%3/3
A and B
A= @_B= ref $_[0] eq "HASH"
| |||||||||||||||||||||||||||||
| 162 | 13 | ▶ | my $msg = @_ ? shift : "Pod coverage on $module"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | 13 | ▶ | my $pc_class = (delete $parms{coverage_class}) || 'Pod::Coverage'; | ||||||||||||||||||||||||||
|
Condition100%2/2
delete $parms{'coverage_class'} || 'Pod::Coverage'
MC/DC100%1/1
delete $parms{'coverage_class'} || 'Pod::Coverage'
delete $parms{'coverage_class'}
Truth table100%2/2
A
A= delete $parms{'coverage_class'}
| |||||||||||||||||||||||||||||
| 165 | 13 | ▶ | eval "require $pc_class" or die $@; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | 13 | my $pc = $pc_class->new( package => $module, %parms ); | |||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | 13 | my $rating = $pc->coverage; | |||||||||||||||||||||||||||
| 170 | 13 | my $ok; | |||||||||||||||||||||||||||
| 171 | 13 | ▶ | if ( defined $rating ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 172 | 10 | $ok = ($rating == 1); | |||||||||||||||||||||||||||
| 173 | 10 | $Test->ok( $ok, $msg ); | |||||||||||||||||||||||||||
| 174 | 10 | ▶ | if ( !$ok ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 175 | 1 | my @nakies = sort $pc->naked; | |||||||||||||||||||||||||||
| 176 | 1 | ▶ | my $s = @nakies == 1 ? "" : "s"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 177 | 1 | $Test->diag( | |||||||||||||||||||||||||||
| 178 | sprintf( "Coverage for %s is %3.1f%%, with %d naked subroutine$s:", | ||||||||||||||||||||||||||||
| 179 | $module, $rating*100, scalar @nakies ) ); | ||||||||||||||||||||||||||||
| 180 | 1 | $Test->diag( "\t$_" ) for @nakies; | |||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||
| 183 | else { # No symbols | ||||||||||||||||||||||||||||
| 184 | 3 | my $why = $pc->why_unrated; | |||||||||||||||||||||||||||
| 185 | 3 | my $nopublics = ( $why =~ "no public symbols defined" ); | |||||||||||||||||||||||||||
| 186 | 3 | ▶ | my $verbose = $ENV{HARNESS_VERBOSE} || 0; | ||||||||||||||||||||||||||
|
Condition100%2/2
$ENV{'HARNESS_VERBOSE'} || 0
MC/DC100%1/1
$ENV{'HARNESS_VERBOSE'} || 0
$ENV{'HARNESS_VERBOSE'}
Truth table100%2/2
A
A= $ENV{'HARNESS_VERBOSE'}
| |||||||||||||||||||||||||||||
| 187 | 3 | $ok = $nopublics; | |||||||||||||||||||||||||||
| 188 | 3 | $Test->ok( $ok, $msg ); | |||||||||||||||||||||||||||
| 189 | 3 | ▶ | $Test->diag( "$module: $why" ) unless ( $nopublics && !$verbose ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$nopublics and not $verbose
MC/DC100%2/2
$nopublics and not $verbose
$nopublics
not $verbose
Truth table100%3/3
A and not(B)
A= $nopublicsB= not $verbose
| |||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | 13 | return $ok; | |||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||
| 195 | =head2 all_modules( [@dirs] ) | ||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | Returns a list of all modules in I<$dir> and in directories below. If | ||||||||||||||||||||||||||||
| 198 | no directories are passed, it defaults to F<blib> if F<blib> exists, | ||||||||||||||||||||||||||||
| 199 | or F<lib> if not. | ||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||
| 201 | Note that the modules are as "Foo::Bar", not "Foo/Bar.pm". | ||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||
| 203 | The order of the files returned is machine-dependent. If you want them | ||||||||||||||||||||||||||||
| 204 | sorted, you'll have to sort them yourself. | ||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||
| 206 | =cut | ||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||
| 208 | 2 | ▶ | sub all_modules { | ||||||||||||||||||||||||||
|
Subroutine
all_modules: called CC=16 SCAR=29.5
Pod
documented
| |||||||||||||||||||||||||||||
| 209 | 2 | ▶ | my @starters = @_ ? @_ : _starting_points(); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 210 | 2 | my %starters = map {$_,1} @starters; | |||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||
| 212 | 2 | my @queue = @starters; | |||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||
| 214 | 2 | my @modules; | |||||||||||||||||||||||||||
| 215 | 2 | ▶ | while ( @queue ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 216 | 52 | my $file = shift @queue; | |||||||||||||||||||||||||||
| 217 | 52 | ▶ | if ( -d $file ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 218 | 34 | local *DH; | |||||||||||||||||||||||||||
| 219 | 34 | ▶ | opendir DH, $file or next; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 220 | 34 | my @newfiles = readdir DH; | |||||||||||||||||||||||||||
| 221 | 34 | closedir DH; | |||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||
| 223 | 34 | @newfiles = File::Spec->no_upwards( @newfiles ); | |||||||||||||||||||||||||||
| 224 | 34 | ▶ | @newfiles = grep { $_ ne "CVS" && $_ ne ".svn" } @newfiles; | ||||||||||||||||||||||||||
|
Condition33%1/3
$_ ne 'CVS' && $_ ne '.svn'
MC/DC0%0/2
$_ ne 'CVS' && $_ ne '.svn'
$_ ne 'CVS'
$_ ne '.svn'
Truth table33%1/3
A && B
A= $_ ne 'CVS'B= $_ ne '.svn'
| |||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||
| 226 | 34 | push @queue, map "$file/$_", @newfiles; | |||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||
| 228 | 52 | ▶ | if ( -f $file ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 229 | 18 | ▶ | next unless $file =~ /\.pm$/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | 2 | my @parts = File::Spec->splitdir( $file ); | |||||||||||||||||||||||||||
| 232 | 2 | ▶ | shift @parts if @parts && exists $starters{$parts[0]}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@parts and exists $starters{$parts[0]}
MC/DC0%0/2
@parts and exists $starters{$parts[0]}
@parts
exists $starters{$parts[0]}
Truth table33%1/3
A and B
A= @partsB= exists $starters{$parts[0]}
| |||||||||||||||||||||||||||||
| 233 | 2 | ▶ | shift @parts if @parts && $parts[0] eq "lib"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@parts and $parts[0] eq "lib"
MC/DC0%0/2
@parts and $parts[0] eq "lib"
@parts
$parts[0] eq "lib"
Truth table33%1/3
A and B
A= @partsB= $parts[0] eq "lib"
| |||||||||||||||||||||||||||||
| 234 | 2 | ▶ | $parts[-1] =~ s/\.pm$// if @parts; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||
| 236 | # Untaint the parts | ||||||||||||||||||||||||||||
| 237 | 2 | for ( @parts ) { | |||||||||||||||||||||||||||
| 238 | 6 | ▶ | if ( /^([a-zA-Z0-9_\.\-]+)$/ && ($_ eq $1) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
/^([a-zA-Z0-9_\.\-]+)$/ and $_ eq $1
MC/DC0%0/2
/^([a-zA-Z0-9_\.\-]+)$/ and $_ eq $1
/^([a-zA-Z0-9_\.\-]+)$/
$_ eq $1
Truth table33%1/3
A and B
A= /^([a-zA-Z0-9_\.\-]+)$/B= $_ eq $1
| |||||||||||||||||||||||||||||
| 239 | 6 | $_ = $1; # Untaint the original | |||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||
| 241 | else { | ||||||||||||||||||||||||||||
| 242 | 0 | die qq{Invalid and untaintable filename "$file"!}; | |||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||
| 245 | 2 | my $module = join( "::", @parts ); | |||||||||||||||||||||||||||
| 246 | 2 | push( @modules, $module ); | |||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||
| 248 | } # while | ||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||
| 250 | 2 | return @modules; | |||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||
| 253 | 1 | ▶ | sub _starting_points { | ||||||||||||||||||||||||||
|
Subroutine
_starting_points: called CC=2 SCAR=9.2
| |||||||||||||||||||||||||||||
| 254 | 1 | ▶ | return 'blib' if -e 'blib'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 255 | 0 | return 'lib'; | |||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||
| 258 | =head1 BUGS | ||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | Please report any bugs or feature requests to | ||||||||||||||||||||||||||||
| 261 | C<bug-test-pod-coverage at rt.cpan.org>, or through the web interface at | ||||||||||||||||||||||||||||
| 262 | L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Pod-Coverage>. | ||||||||||||||||||||||||||||
| 263 | I will be notified, and then you'll automatically be notified of progress on | ||||||||||||||||||||||||||||
| 264 | your bug as I make changes. | ||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||
| 266 | =head1 SUPPORT | ||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||
| 268 | You can find documentation for this module with the perldoc command. | ||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||
| 270 | perldoc Test::Pod::Coverage | ||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||
| 272 | You can also look for information at: | ||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||
| 274 | =over 4 | ||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | =item * AnnoCPAN: Annotated CPAN documentation | ||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||
| 278 | L<http://annocpan.org/dist/Test-Pod-Coverage> | ||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||
| 280 | =item * CPAN Ratings | ||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||
| 282 | L<http://cpanratings.perl.org/d/Test-Pod-Coverage> | ||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||
| 284 | =item * RT: CPAN's request tracker | ||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||
| 286 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Test-Pod-Coverage> | ||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||
| 288 | =item * Search CPAN | ||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||
| 290 | L<http://search.cpan.org/dist/Test-Pod-Coverage> | ||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||
| 292 | =back | ||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||
| 294 | =head1 REPOSITORY | ||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||
| 296 | L<https://github.com/neilbowers/Test-Pod-Coverage> | ||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||
| 298 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||
| 300 | Written by Andy Lester, C<< <andy at petdance.com> >>. | ||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||
| 302 | =head1 ACKNOWLEDGEMENTS | ||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||
| 304 | Thanks to Ricardo Signes for patches, and Richard Clamp for | ||||||||||||||||||||||||||||
| 305 | writing Pod::Coverage. | ||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||
| 307 | =head1 COPYRIGHT & LICENSE | ||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||
| 309 | Copyright 2006, Andy Lester, All Rights Reserved. | ||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||
| 311 | This program is free software; you can redistribute it and/or modify it | ||||||||||||||||||||||||||||
| 312 | under the terms of the Artistic License version 2.0. | ||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||
| 314 | See http://dev.perl.org/licenses/ for more information | ||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||
| 316 | =cut | ||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||
| 318 | 10 | 1; | |||||||||||||||||||||||||||