| 1 |
package Pod::Coverage::Imager; |
| 2 |
use 5.006; |
| 3 |
use strict; |
| 4 |
use base 'Pod::Coverage'; |
| 5 |
|
| 6 |
our $VERSION = "1.000"; |
| 7 |
|
| 8 |
sub _get_pods { |
| 9 |
my $self = shift; |
| 10 |
|
| 11 |
my $package = $self->{package}; |
| 12 |
|
| 13 |
#print "getting pod location for '$package'\n" if TRACE_ALL; |
| 14 |
$self->{pod_from} ||= pod_where( { -inc => 1 }, $package ); |
| 15 |
|
| 16 |
my $pod_from = $self->{pod_from}; |
| 17 |
$pod_from = [ $pod_from ] unless ref $pod_from; |
| 18 |
unless ($pod_from) { |
| 19 |
$self->{why_unrated} = "couldn't find pod"; |
| 20 |
return; |
| 21 |
} |
| 22 |
|
| 23 |
#print "parsing '$pod_from'\n" if TRACE_ALL; |
| 24 |
my $pod = Pod::Coverage::Extractor->new; |
| 25 |
for my $pod_file (@$pod_from) { |
| 26 |
$pod->parse_from_file( $pod_file, '/dev/null' ); |
| 27 |
} |
| 28 |
|
| 29 |
return $pod->{identifiers} || []; |
| 30 |
} |
| 31 |
|
| 32 |
sub _get_syms { |
| 33 |
my ($self, $package) = @_; |
| 34 |
|
| 35 |
if ($self->{module}) { |
| 36 |
eval "require $self->{module}"; |
| 37 |
return if $@; |
| 38 |
|
| 39 |
# fake out require |
| 40 |
(my $file = $package) =~ s(::)(/)g; |
| 41 |
$file .= ".pm"; |
| 42 |
$INC{$file} = 1; |
| 43 |
} |
| 44 |
|
| 45 |
return $self->SUPER::_get_syms($package); |
| 46 |
} |
| 47 |
|
| 48 |
1; |