File Coverage

lib/Decl/Semantics/POD.pm
Criterion Covered Total %
statement 17 18 94.4
branch 1 2 50.0
condition n/a
subroutine 5 6 83.3
pod 3 3 100.0
total 26 29 89.6


line stmt bran cond sub pod time code
1             package Decl::Semantics::POD;
2            
3 12     12   80 use warnings;
  12         25  
  12         482  
4 12     12   68 use strict;
  12         26  
  12         475  
5            
6 12     12   70 use base qw(Decl::Node);
  12         23  
  12         4622  
7            
8             =head1 NAME
9            
10             Decl::Semantics::POD - implements POD documentation in a declarative framework.
11            
12             =head1 VERSION
13            
14             Version 0.02
15            
16             =cut
17            
18             our $VERSION = '0.02';
19            
20            
21             =head1 SYNOPSIS
22            
23             Obviously, POD documentation doesn't *do* anything, but we'll be able to scan the tree for POD documentation and get it all out in sequence.
24             The main benefit from the POD module is to permit convenient indentation for POD code, like this:
25            
26             pod head2 "Explanatory title"
27             This function will do all kinds of neat stuff
28             and here's an example of how to use it:
29            
30             (code POD will see as indented)
31            
32             And then we finish our explanation.
33            
34             do { some code }
35            
36             The text that POD sees will automatically have =head2 and =cut added to the start and end, and will be de-indented to the lowest indentation level
37             in the text defined as POD.
38            
39             =head2 defines(), tags_defined()
40            
41             Called by Decl::Semantics during import, to find out what xmlapi tags this plugin claims to implement.
42             The asterisk means indented lines will all be put into the body of this tag even if not surrounded by curly braces.
43            
44             =cut
45            
46 0     0 1 0 sub defines { ('pod'); }
47             our %build_handlers = ( pod => { node => sub { Decl::Semantics::POD->new (@_) }, body => 'none' } );
48 12     12 1 97 sub tags_defined { Decl->new_data(<
49             pod (body=text)
50             EOF
51            
52             =head2 extract
53            
54             This is the only POD-specific function provided; it extracts the POD documentation. If we do a C on the root of the tree,
55             we can get a sequential list of all POD nodes, so Cextract() } search_first ('pod')> gives us the POD for the whole tree.
56            
57             =cut
58            
59             sub extract {
60 1     1 1 3 my $self = shift;
61 1         3 my $ret = '';
62            
63 1 50       17 if ($self->name) {
64 1         5 $ret .= "=" . $self->name . " " . $self->label . "\n\n";
65             }
66 1         7 $ret .= $self->body;
67 1         5 $ret .= "\n=cut\n";
68 1         4 return $ret;
69             }
70            
71             =head1 AUTHOR
72            
73             Michael Roberts, C<< >>
74            
75             =head1 BUGS
76            
77             Please report any bugs or feature requests to C, or through
78             the web interface at L. I will be notified, and then you'll
79             automatically be notified of progress on your bug as I make changes.
80            
81             =head1 LICENSE AND COPYRIGHT
82            
83             Copyright 2010 Michael Roberts.
84            
85             This program is free software; you can redistribute it and/or modify it
86             under the terms of either: the GNU General Public License as published
87             by the Free Software Foundation; or the Artistic License.
88            
89             See http://dev.perl.org/licenses/ for more information.
90            
91             =cut
92            
93             1; # End of Decl::Semantics::POD