File Coverage

blib/lib/Pod/HTMLEmbed.pm
Criterion Covered Total %
statement 26 30 86.6
branch 2 6 33.3
condition n/a
subroutine 7 7 100.0
pod 2 2 100.0
total 37 45 82.2


line stmt bran cond sub pod time code
1             package Pod::HTMLEmbed;
2 4     4   30729 use Any::Moose;
  4         141587  
  4         29  
3              
4             our $VERSION = '0.04';
5              
6 4     4   6574 use Carp::Clan '^(Mo[ou]se::|Pod::HTMLEmbed(::)?)';
  4         22784  
  4         38  
7 4     4   6253 use Pod::Simple::Search;
  4         24143  
  4         123  
8 4     4   2254 use Pod::HTMLEmbed::Entry;
  4         385  
  4         266  
9              
10             has search_dir => (
11             is => 'rw',
12             isa => 'ArrayRef',
13             predicate => 'has_search_dir',
14             );
15              
16             has url_prefix => (
17             is => 'rw',
18             isa => 'Str',
19             predicate => 'has_url_prefix',
20             );
21              
22 4     4   38 no Any::Moose;
  4         10  
  4         30  
23              
24             sub load {
25 3     3 1 266 my ($self, $file) = @_;
26 3         66 Pod::HTMLEmbed::Entry->new( file => $file, _context => $self );
27             }
28              
29             sub find {
30 2     2 1 372 my ($self, $name) = @_;
31              
32 2         5 my $file;
33 2         25 my $finder = Pod::Simple::Search->new;
34              
35 2 50       93 if ($self->has_search_dir) {
36 2         10 $finder->inc(0);
37 2         15 $file = $finder->find( $name, @{ $self->search_dir } );
  2         17  
38             }
39             else {
40 0         0 $file = $finder->find( $name );
41             }
42              
43 2 50       559 unless ($file) {
44 0         0 my $dirs = join ':', $self->has_search_dir ?
45 0 0       0 (@{ $self->search_dir }) : (@INC);
46              
47 0         0 croak qq[No pod found by name "$name" in $dirs];
48             }
49              
50 2         40 $self->load($file);
51             }
52              
53             __PACKAGE__->meta->make_immutable;
54              
55             __END__