File Coverage

blib/lib/Papery/Processor/Pod/POM.pm
Criterion Covered Total %
statement 10 12 83.3
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 14 16 87.5


line stmt bran cond sub pod time code
1             package Papery::Processor::Pod::POM;
2              
3 1     1   884 use strict;
  1         2  
  1         57  
4 1     1   6 use warnings;
  1         3  
  1         34  
5              
6 1     1   541 use Papery::Processor;
  1         3  
  1         49  
7             our @ISA = qw( Papery::Processor );
8              
9 1     1   441 use Pod::POM;
  0            
  0            
10              
11             sub process {
12             my ( $self, $pulp ) = @_;
13              
14             # parse the pod
15             my $parser = Pod::POM->new( meta => 1 );
16             my $pom = $parser->parse_text( $pulp->{meta}{_text} )
17             or die $parser->error();
18              
19             # process the pod
20             my $class = $pulp->{meta}{pod_pom_view} || 'Pod::POM::View::HTML';
21             eval "use $class; 1;" or die $@;
22             my $view = $class->new();
23             my $content = $view->print($pom);
24              
25             # post-process the output of HTML views
26             if ( $view->isa( 'Pod::POM::View::HTML' ) ) {
27             $content =~ s{]*>}{}g;
28             }
29              
30             # merge the metadata and content
31             $pulp->merge_meta( $pom->metadata );
32             $pulp->{meta}{_content} = $content;
33             $pulp->{meta}{_pod_pom} = $pom;
34              
35             return $pulp;
36             }
37              
38             1;
39              
40             __END__