File Coverage

blib/lib/Pod/Abstract/Filter/clear_podcmds.pm
Criterion Covered Total %
statement 6 13 46.1
branch 0 2 0.0
condition n/a
subroutine 2 3 66.6
pod 1 1 100.0
total 9 19 47.3


line stmt bran cond sub pod time code
1             package Pod::Abstract::Filter::clear_podcmds;
2 1     1   992 use strict;
  1         1  
  1         32  
3              
4 1     1   5 use base qw(Pod::Abstract::Filter);
  1         2  
  1         178  
5              
6             our $VERSION = '0.20';
7              
8             =head1 NAME
9              
10             Pod::Abstract::Filter::clear_podcmds - paf command to remove =pod commands
11             from the begining of Pod blocks.
12              
13             =cut
14              
15             sub filter {
16 0     0 1   my $self = shift;
17 0           my $pa = shift;
18              
19 0           my ($first_node) = $pa->select("/(0)");
20 0           my @pod_cmds = $pa->select(
21             "//pod[!<<#cut]"
22             );
23 0           foreach my $pod_cmd (@pod_cmds) {
24             # The start of the document is in cut mode, even if there is
25             # no text there, so if the lead node is an =pod node don't
26             # strip it.
27 0 0         $pod_cmd->detach
28             unless $pod_cmd->serial == $first_node->serial;
29             }
30            
31 0           return $pa;
32             }
33              
34             =head1 AUTHOR
35              
36             Ben Lilburne
37              
38             =head1 COPYRIGHT AND LICENSE
39              
40             Copyright (C) 2009 Ben Lilburne
41              
42             This program is free software; you can redistribute it and/or modify
43             it under the same terms as Perl itself.
44              
45             =cut
46              
47             1;