generate_pod.pl untested

filter: Statementstmt 0.0% 0 / 15 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod n/a totaltotal 0.0% 0 / 19 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 use POD::Generate;
2 use strict;
3 use warnings;
4 use lib 'lib';
5  
6 my $pg = POD::Generate->new();
7  
8 my $version = 'v0.02';
9  
10 my $string = $pg->start('POD::Generate', 'programmatically generate plain old documentation')
11 ->version($version)
12 ->synopsis(q{ use POD::Generate;
13
14 my $pg = POD::Generate->new();
15  
16 my $data = $pg->start("Test::Memory")
17 ->synopsis(qq|This is a code snippet.\n\n\tuse Test::Memory;\n\n\tmy \$memory = Test::Memory->new();|)
18 ->description(q|A test of ones memory.|)
19 ->methods
20 ->h2("Mind", "The element of a person that enables them to be aware of the world and their experiences, to think, and to feel; the faculty of consciousness and thought.")
21 ->v(q| $memory->Mind();|)
22 ->h3("Intelligence", "A person or being with the ability to acquire and apply knowledge and skills.")
23 ->v(q| $memory->Mind->Intelligence();|)
24 ->h4("Factual", "Concerned with what is actually the case.")
25 ->v(q| $memory->Mind->Intelligence->Factual(%params);|)
26 ->item("one", "Oxford, Ticehurst and Potters Bar.")
27 ->item("two", "Koh Chang, Zakynthos and Barbados.")
28 ->item("three", "An event or occurrence which leaves an impression on someone.")
29 ->footer(
30 name => "LNATION",
31 email => 'email@lnation.org'
32 )
33 ->end("string");
34  
35  
36 produces...
37  
38 =head1 NAME
39  
40 Test::Memory
41  
42 =cut
43  
44 =head1 SYNOPSIS
45  
46 This is a code snippet.
47  
48 use Test::Memory;
49  
50 my $memory = Test::Memory->new();
51  
52 =cut
53  
54 =head1 DESCRIPTION
55  
56 A test of ones memory.
57  
58 =cut
59  
60 =head1 METHODS
61  
62 =cut
63  
64 =head2 Mind
65  
66 The element of a person that enables them to be aware of the world and their experiences, to think,
67 and to feel; the faculty of consciousness and thought.
68  
69 $memory->Mind();
70  
71 =cut
72  
73 =head3 Intelligence
74  
75 A person or being with the ability to acquire and apply knowledge and skills.
76  
77 $memory->Mind->Intelligence();
78  
79 =cut
80  
81 =head4 Factual
82  
83 Concerned with what is actually the case.
84  
85 $memory->Mind->Intelligence->Factual(%params);
86  
87 =over
88  
89 =item one
90  
91 Oxford, Ticehurst and Potters Bar.
92  
93 =item two
94  
95 Koh Chang, Zakynthos and Barbados.
96  
97 =item three
98  
99 An event or occurrence which leaves an impression on someone.
100  
101 =back
102  
103 =cut
104  
105 =head1 AUTHOR
106  
107 LNATION, C<< <email at lnation.org> >>
108  
109 =cut
110  
111 =head1 BUGS
112  
113 Please report any bugs or feature requests to C<bug-test-memory at rt.cpan.org>, or through
114 the web interface at L<https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Memory>. I will
115 be notified, and then you'll automatically be notified of progress on your bug as I make changes.
116  
117 =cut
118  
119 =head1 SUPPORT
120  
121 You can find documentation for this module with the perldoc command.
122  
123 perldoc Test::Memory
124  
125 You can also look for information at:
126  
127 =over
128  
129 =item * RT: CPAN's request tracker (report bugs here)
130  
131 L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Test-Memory
132  
133 =item * CPAN Ratings
134  
135 L<https://cpanratings.perl.org/d/Test-Memory>
136  
137 =item * Search CPAN
138  
139 L<https://metacpan.org/release/Test-Memory>
140  
141 =back
142  
143 =cut
144  
145 =head1 ACKNOWLEDGEMENTS
146  
147 =cut
148  
149 =head1 LICENSE AND COPYRIGHT
150  
151 This software is Copyright (c) 2022 LNATION
152  
153 This is free software, licensed under:
154  
155 The Artistic License 2.0 (GPL Compatible)
156  
157 =cut
158  
159  
160 =cut})->description(q|This module purpose is to assist with programmatically generating plain old documentation from code.|)
161 ->methods
162 ->h2(q|new|, q|Instantiate a new L<POD::Generate> object. This accepts the following parameters most of which are callbacks which are called when you set a specific plain old document command/identifier.|)
163 ->p(q| POD::Generate->new(
164 pod => [ ... ],
165 p_cb => sub { ... },
166 h1_cb => sub { ... },
167 h2_cb => sub { ... },
168 h3_cb => sub { ... },
169 h4_cb => sub { ... },
170 item_cb => sub { ... },
171 version_cb => sub { ... },
172 description_cb => sub { ... },
173 synopsis_cb => sub { ... },
174 methods_cb => sub { ... },
175 exports_cb => sub { ... },
176 author_cb => sub { ... },
177 bugs_cb => sub { ... },
178 support_cb => sub { ... },
179 acknowledgements_cb => sub { ... },
180 license_cb => sub { ... }
181 );|)
182 ->h3(q|pod|, q|An existing internal pod struct which can either be a hash reference if it's the parent object or an array ref if it is a child object which relates to a specific single package.|)
183 ->h3("p_cb", "A callback called each time the p method is called, it should be used to manipulate the data which is added to the pod array.")
184 ->h3("h1_cb", "A callback called each time the h1 method is called, it should be used to manipulate the data which is added to the pod array.")
185 ->h3("h2_cb", "A callback called each time the h2 method is called, it should be used to manipulate the data which is added to the pod array.")
186 ->h3("h3_cb", "A callback called each time the h3 method is called, it should be used to manipulate the data which is added to the pod array.")
187 ->h3("h4_cb", "A callback called each time the h4 method is called, it should be used to manipulate the data which is added to the pod array.")
188 ->h3("item_cb", "A callback called each time the item method is called, it should be used to manipulate the data which is added to the pod array.")
189 ->h3("versioncb", "A callback triggered each time the version method is called, it should be used to manipulate the data which is added to the pod array.")
190 ->h3("description_cb", "A callback triggered each time the description method is called, it should be used to manipulate the data which is added to the pod array.")
191 ->h3("synopsis_cb", "A callback triggered each time the synopsis method is called, it should be used to manipulate the data which is added to the pod array.")
192 ->h3("methods_cb", "A callback triggered each time the methods method is called, it should be used to manipulate the data which is added to the pod array.")
193 ->h3("exports_cb", "A callback triggered each time the exports method is called, it should be used to manipulate the data which is added to the pod array.")
194 ->h3("author_cb", "A callback triggered each time the author method is called, it should be used to manipulate the data which is added to the pod array.")
195 ->h3("bugs_cb", "A callback triggered each time the bugs method is called, it should be used to manipulate the data which is added to the pod array.")
196 ->h3("support_cb", "A callback triggered each time the support method is called, it should be used to manipulate the data which is added to the pod array.")
197 ->h3("support_items_cb", "A callback triggered each time the support method is called, it should be used to manipulate the data which is added to the pod array.")
198 ->h3("acknowledgements_cb", "A callback triggered each time the acknowledgements method is called, it should be used to manipulate the data which is added to the pod array.")
199 ->h3("license_cb", "A callback triggered each time the license method is called, it should be used to manipulate the data which is added to the pod array.")
200 ->h2("pod", "A reference to the internal pod struct which can either be a hash reference if it's the parent object or an array reference if it is a child object which relates to a specific single package.")
201 ->v(q| $pg->pod;|)
202 ->h2("start", "Start documentation for a new module/package/thing, it is equivalent to calling the ->name. method.")
203 ->v(q| $pg->start($name, $abbr);|)
204 ->h2("end", "End the documentation for a new module/package/thing, it is equivalent to calling the ->generate method.")
205 ->v(q| $pg->end($type);|)
206 ->h2("name", "Start documentation for a new module/package/thing, name accepts two parameteres a name of the thing and an summary of what the thing does. The summary is prepended to the name in the NAME section of the plain old documentation.")
207 ->v(q| $pg->name($module, $summary)|)
208 ->h2("generate", "End documentation for a new module/package/thing, generate accepts a single param which is the type of generation you would like. Currently there are three options they are string, file and seperate_file.")
209 ->v(q| $pg->generate($type)|)
210 ->h2("add", "This is a generic method to add a new section to the POD array, many of the following methods are just wrappers around this add method. It accepts three parameters the identifier/command, the title for the section and the content. All params are optional and undefs can be passed if that is what you desire to do.")
211 ->v(q| $pg->add($identifier, $title, $content)|)
212 ->h2("p", "Add a new paragraph to the current section, this method will format the text to be fixed width of 100 characters.")
213 ->v(q| $pg->p($content)|)
214 ->h2("v", "Add a new verbose paragraph to the current section, this method does not format the width of the content input so will render as passed.")
215 ->v(q| $pg->v($content)|)
216 ->h2("h1", "Add a new head1 section.")
217 ->v(q| $pg->h1($title, $content)|)
218 ->h2("h2", "Add a new head2 section.")
219 ->v(q| $pg->h2($title, $content)|)
220 ->h2("h3", "Add a new head3 section.")
221 ->v(q| $pg->h3($title, $content)|)
222 ->h2("h4", "Add a new head4 section.")
223 ->v(q| $pg->h4($title, $content)|)
224 ->h2("item", "Add a new item section, this will automatically add the over and back identifiers/commands.")
225 ->v(q| $pg->item($title, $content)|)
226 ->h2("version", "Add a new head1 VERSION section.")
227 ->v(q| $pg->version($content)|)
228 ->h2("description", "Add a new head1 DESCRIPTION section.")
229 ->v(q| $pg->item($content)|)
230 ->h2("synopsis", "Add a new head1 SYNOPSIS section.")
231 ->v(q| $pg->synopsis($content)|)
232 ->h2("methods", "Add a new head1 METHODS section.")
233 ->v(q| $pg->methods($content)|)
234 ->h2("exports", "Add a new head1 EXPORTS section.")
235 ->v(q| $pg->exports($content)|)
236 ->h2("footer", "Add the footer to a module/packages POD, this will call formatted_author, bugs, support, acknowledgements and license in that order using there default values or values set in callbacks.")
237 ->v(q| $pg->footer(
238 name => "LNATION",
239 email => "email\@lnation.org",
240 bugs => "...",
241 support => "...",
242 support_items => "...",
243 acknowledgements => "...",
244 license => "...",
245 );|)
246 ->h2("author", "Add a new head1 AUTHOR section.")
247 ->v(q| $pg->author($content)|)
248 ->h2("formatted_author", "Add a new head1 AUTHOR section, this accepts two parameters the authors name and the authors email.")
249 ->v(q| $pg->author($author_name, $author_email)|)
250 ->h2("bugs", "Add a new head1 BUGS section.")
251 ->v(q| $pg->bugs($content)|)
252 ->h2("support", "Add a new head1 SUPPORT section.")
253 ->v(q| $pg->support($content)|)
254 ->h2("acknowledgements", "Add a new head1 ACKNOWLEDGEMENTS section.")
255 ->v(q| $pg->acknowledgements($content)|)
256 ->h2("license", "Add a new head1 LICENSE section.")
257 ->v(q| $pg->license($content)|)
258 ->h2("to_string", "Generate the current plain old documentation using what is stored in the pod attribute and return it as a string.")
259 ->v(q| $pg->to_string()|)
260 ->h2("to_file", "Generate the current plain old documentation using what is stored in the pod attribute and write it to the end of the modules file. The module must have an __END__ tag and anything which comes after will be re-written.")
261 ->v(q| $pg->to_file()|)
262 ->h2("to_seperate_file", "Generate the current plain old documentation using what is stored in the pod attribute and write it to a new .pod file for the given named module. Each run this file will be re-written.")
263 ->v(q| $pg->to_seperate_file()|)
264 ->footer(name => "LNATION", email => "email\@lnation.org")
265 ->end('file');