File Coverage

blib/lib/Pod/Strip.pm
Criterion Covered Total %
statement 23 23 100.0
branch 6 6 100.0
condition n/a
subroutine 6 6 100.0
pod 2 2 100.0
total 37 37 100.0


line stmt bran cond sub pod time code
1             package Pod::Strip;
2              
3             # ABSTRACT: Remove POD from Perl code
4             our $VERSION = '1.100'; # VERSION
5              
6 2     2   140420 use warnings;
  2         25  
  2         75  
7 2     2   11 use strict;
  2         4  
  2         48  
8              
9 2     2   10 use base ('Pod::Simple');
  2         4  
  2         1427  
10              
11             sub new {
12 3     3 1 1118 my $new = shift->SUPER::new(@_);
13 3         101 $new->{_code_line}=0;
14             $new->code_handler(
15             sub {
16             # Add optional line directives
17 51 100   51   5936 if ($_[2]->{_replace_with_comments}) {
18 10 100       24 if ($_[2]->{_code_line}+1<$_[1]) {
19 2         5 print {$_[2]{output_fh}} ("# stripped POD\n") x ($_[1] - $_[2]->{_code_line} -1 );
  2         13  
20             }
21 10         40 $_[2]->{_code_line}=$_[1];
22             }
23 51         61 print {$_[2]{output_fh}} $_[0],"\n";
  51         114  
24 51         455 return;
25 3         35 });
26 3         29 return $new;
27             }
28              
29             sub replace_with_comments {
30 2     2 1 11 my $self = shift;
31 2 100       14 $self->{_replace_with_comments} = defined $_[0] ? $_[0] : 1;
32             }
33              
34             1;
35              
36             __END__