File Coverage

blib/lib/Pod/Abstract/Filter/ptree.pm
Criterion Covered Total %
statement 12 19 63.1
branch n/a
condition n/a
subroutine 4 5 80.0
pod 1 1 100.0
total 17 25 68.0


line stmt bran cond sub pod time code
1             package Pod::Abstract::Filter::ptree;
2 1     1   1180 use strict;
  1         3  
  1         45  
3 1     1   5 use warnings;
  1         2  
  1         76  
4              
5 1     1   7 use base qw(Pod::Abstract::Filter);
  1         2  
  1         158  
6 1     1   8 use Pod::Abstract::BuildNode qw(node);
  1         2  
  1         204  
7              
8             our $VERSION = '0.26';
9              
10             =head1 NAME
11              
12             Pod::Abstract::Filter::ptree - convert the incoming document to a
13             summarised parse tree, and dump that into a verbatim block.
14              
15             =head1 DESCRIPTION
16              
17             This can be very useful to understand the generated structure of a POD
18             file when you are building your own filters or code based on
19             L.
20              
21             =head1 USAGE
22              
23             $ paf ptree bin/paf
24            
25             ...
26              
27             Parse Tree
28             1 [[ROOT]]
29             2 [#cut] #!/usr/bin/perl
30             3 [#cut] package paf;use strict;use warnings;
31             4 [#cut] use Pod::Abstract;use Pod::Abstract::Filter;
32             5 [#cut] use File::Temp qw(tempfile tempdir);
33             8 [head1] NAME
34             9 [:paragraph]
35             10 [:text] paf - Pod Abstract Filter. Transform Pod documents from t
36             <... etc>
37              
38             =head1 METHODS
39              
40             =head2 filter
41              
42             This is the only method for the module, and it just makes use of the
43             L method to generate a visual parse tree,
44             and nests that into a heading generated by L.
45              
46             =cut
47              
48             sub filter {
49 0     0 1   my $self = shift;
50 0           my $pa = shift;
51              
52 0           my $ptree = node->verbatim( $pa->ptree );
53 0           my $pt_block = node->head1('Parse Tree');
54 0           $pt_block->nest($ptree);
55            
56 0           $pt_block->coalesce_body(':text');
57            
58 0           return $pt_block;
59             }
60              
61             1;