blib/lib/Pod/FromActionscript.pm

filter: Statementstmt 94.6% 176 / 186 Branchbran 91.8% 79 / 86 Conditioncond 80.0% 16 / 20 MC/DCmcdc 69.2% 9 / 13 Subroutinesub 100% 16 / 16 Podpod 100% 1 / 1 totaltotal 92.2% 297 / 322 CC 52 SCAR 27.9
CC
52
Cov
93%
_convert
30.4
_write_output
10.2
_get_input
6.0
CRAP 16.2
↑ Summary
1 package Pod::FromActionscript;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use Exporter;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 our $VERSION = "0.53";
9 2 our @ISA = qw(Exporter);
10 2 our @EXPORT = qw();
11 2 our @EXPORT_OK = qw(asdoc2pod);
12  
13 # Use Regexp::Common if available, but fall back to an extract from
14 # v2.120 if needed
15 0 ▶our $comment_re =
Subroutine BEGIN: called CC=1 SCAR=1.2
Condition50%1/2
eval q[local $SIG{__WARN__} = 'DEFAULT'; local $SIG{__DIE__} = 'DEFAULT';use Regexp::Common qw(comment); $RE{comment}{C}] || qr"(?:(?:/\*)(?:(?:[^\*]+|\*(?!/))*)(?:\*/))"
l!l
02
MC/DC0%0/1
eval q[local $SIG{__WARN__} = 'DEFAULT'; local $SIG{__DIE__} = 'DEFAULT';use Regexp::Common qw(comment); $RE{comment}{C}] || qr"(?:(?:/\*)(?:(?:[^\*]+|\*(?!/))*)(?:\*/))"
eval q[local $SIG{__WARN__} = 'DEFAULT'; local $SIG{__DIE__} = 'DEFAULT';use Regexp::Common qw(comment); $RE{comment}{C}]
Truth table50%1/2
A
A= eval q[local $SIG{__WARN__} = 'DEFAULT'; local $SIG{__DIE__} = 'DEFAULT';use Regexp::Common qw(comment); $RE{comment}{C}]
Aresult
11
00
16 eval("local \$SIG{__WARN__} = 'DEFAULT'; local \$SIG{__DIE__} = 'DEFAULT';".
17 "use Regexp::Common qw(comment); \$RE{comment}{C}")
18 || qr/(?:(?:\/\*)(?:(?:[^\*]+|\*(?!\/))*)(?:\*\/))/;
19  
20 =head1 NAME
21  
22 Pod::FromActionscript - Convert Actionscript documentation to POD
23  
24 =head1 SYNOPSIS
25  
26 use Pod::FromActionscript (asdoc2pod);
27 asdoc2pod(infile => "com/clotho/Foo.as", outfile => "com.clotho.Foo.pod");
28 asdoc2pod(infile => "-" outfile => "-");
29 asdoc2pod(infile => \*STDIN, outfile => \*STDOUT);
30 asdoc2pod(in => $ascontent, out => \$podcontent);
31  
32 or use the C<asdoc2pod> command-line program included in this
33 distribution.
34  
35 =head1 DESCRIPTION
36  
37 Parse Actionscript code, searching for Javadoc-style
38 comments. If any are found, convert them to POD (Perl's Plain Old
39 Documentation format). The output is just the POD, unless the
40 C<code> flag is used, in which case the original Actionscript is
41 output with the Javadoc converted to POD.
42  
43 Only a limited subset of Javadoc commands are understood. See below
44 for the full list. Any unrecognized directives cause parsing to abort.
45 Future versions of this module should handle such failures more
46 gracefully.
47  
48 =head1 LICENSE
49  
50 Copyright 2005 Clotho Advanced Media, Inc., <cpan@clotho.com>
51  
52 This library is free software; you can redistribute it and/or modify it
53 under the same terms as Perl itself.
54  
55 =head1 FUNCTIONS
56  
57 =over
58  
59 =item asdoc2pod OPTIONS...
60  
61 Convert Javadoc-style comments embedded in Actionscript code into POD.
62 The arguments are key-value pairs as follows:
63  
64 =over
65  
66 =item in => SCALAR
67  
68 The input Actionscript code as a string.
69  
70 =item infile => FILENAME
71  
72 =item infile => FILEHANDLE
73  
74 Read the Actionscript code from a file. If the value is a reference,
75 it is assumed to be a filehandle. If it is a scalar, it is assumed to
76 be a filename. If the filename is C<->, then code is read in from
77 C<STDIN>.
78  
79 =item out => SCALARREF
80  
81 The output POD, or an empty string if no Javadoc is detected, is
82 assigned to the specified scalar reference.
83  
84 =item outfile => FILENAME
85  
86 =item outfile => FILEHANDLE
87  
88 Write the POD to a file. If there is no POD found, the no data is
89 written. If the C<outfile> value is a reference, it is assumed to be a
90 filehandle. If it is a scalar, it is assumed to be a filename. If
91 the filename is C<->, then POD is written to C<STDOUT>.
92  
93 =item verbose => BOOLEAN
94  
95 If true, some debugging information is printed. Defaults to false.
96  
97 =item code => BOOLEAN
98  
99 If true, then the Actionscript code is included in the output, with
100 the Javadoc comments replace with appropriate POD comments. If false,
101 then just the POD is output, with the code omitted. Defaults to false.
102  
103 =back
104  
105 =cut
106  
107 sub asdoc2pod
108 22 ▶{
Subroutine asdoc2pod: called CC=1 SCAR=0.0
Pod documented
109 22 my %opts = @_;
110  
111 22 my $in = _get_input(\%opts);
112 20 my $out = _convert($in, \%opts);
113 18 _write_output($out, \%opts);
114 }
115  
116 sub _get_input
117 22 ▶{
Subroutine _get_input: called CC=6 SCAR=17.9
118 22 my $opts = shift;
119  
120 22 my $in;
121 22 ▶ if (exists $opts->{in})
Branch: 2 branches
BranchTrueFalseTotal
if (exists $opts->{'in'}) { } 18 4 22
elsif (exists $opts->{'infile'}) { } 3 1 4
122 {
123 18 $in = $opts->{in};
124 }
125 elsif (exists $opts->{infile})
126 {
127 3 local $/ = undef;
128 3 ▶ if (ref $opts->{infile})
Branch: 2 branches
BranchTrueFalseTotal
if (ref $opts->{'infile'}) { } 1 2 3
elsif ($opts->{'infile'} eq '-') { } 0 2 2
129 {
130 1 my $infh = $opts->{infile};
131 1 $in = <$infh>;
132 }
133 elsif ($opts->{infile} eq "-")
134 {
135 0 $in = <STDIN>;
136 }
137 else
138 {
139 2 local *IN;
140 open(IN, '<', $opts->{infile})
141 2 ▶ or croak("Failed to read file $opts->{infile}: $!\n");
Branch: 1 branch
BranchTrueFalseTotal
open IN, "<", $opts->{"infile"} or croak(qq[Failed to read file $opts->{"infile"}: $!\n]) 1 1 2
142 1 $in = <IN>;
143 1 close(IN);
144 }
145 }
146 else
147 {
148 1 croak("No input source specified\n");
149 }
150 20 return $in;
151 }
152  
153 sub _write_output
154 18 ▶{
Subroutine _write_output: called CC=10 SCAR=23.2
155 18 my $out = shift;
156 18 my $opts = shift;
157  
158 18 ▶ if (exists $opts->{out})
Branch: 3 branches
BranchTrueFalseTotal
if (exists $opts->{'out'}) { } 13 5 18
elsif ($out eq '') { } 1 4 5
elsif (exists $opts->{'outfile'}) { } 3 1 4
159 {
160 13 ▶ if (ref $opts->{out})
Branch: 1 branch
BranchTrueFalseTotal
if (ref $opts->{'out'}) { } 12 1 13
161 {
162 12 my $var = $opts->{out};
163 12 $$var = $out;
164 }
165 else
166 {
167 1 croak("The out parameter is not a reference\n");
168 }
169 }
170 elsif ($out eq "")
171 {
172 # No output
173 }
174 elsif (exists $opts->{outfile})
175 {
176 3 ▶ if (ref $opts->{outfile})
Branch: 2 branches
BranchTrueFalseTotal
if (ref $opts->{'outfile'}) { } 1 2 3
elsif ($opts->{'outfile'} eq '-') { } 0 2 2
177 {
178 1 my $of = $opts->{outfile};
179 1 print $of $out;
180 }
181 elsif ($opts->{outfile} eq "-")
182 {
183 0 print STDOUT $out;
184 }
185 else
186 {
187 2 local *OUT;
188 open(OUT, '>', $opts->{outfile})
189 2 ▶ or croak("Failed to write file $opts->{outfile}: $!\n");
Branch: 1 branch
BranchTrueFalseTotal
open OUT, ">", $opts->{"outfile"} or croak(qq[Failed to write file $opts->{"outfile"}: $!\n]) 1 1 2
190 1 ▶ print(OUT $out)
Branch: 1 branch
BranchTrueFalseTotal
print OUT $out or croak(qq[Failed to write file $opts->{"outfile"}: $!\n]) 1 0 1
191 or croak("Failed to write file $opts->{outfile}: $!\n");
192 1 ▶ close(OUT)
Branch: 1 branch
BranchTrueFalseTotal
close OUT or croak(qq[Failed to write file $opts->{"outfile"}: $!\n]) 1 0 1
193 or croak("Failed to write file $opts->{outfile}: $!\n");
194 }
195 }
196 else
197 {
198 1 croak("No output destination specified\n");
199 }
200 }
201  
202 sub _convert
203 20 ▶{
Subroutine _convert: called CC=30 SCAR=34.1
204 20 my $content = shift;
205 20 my $opts = shift;
206  
207 20 ▶ if (!$opts->{code} && $content !~ /\/\*\*/)
Branch: 1 branch
BranchTrueFalseTotal
unless ($opts->{"code"} or $content =~ m[/\*\*]) 4 16 20
Condition100%3/3
$opts->{"code"} or $content =~ m[/\*\*]
l!l&&r!l&&!r
3134
MC/DC100%2/2
$opts->{"code"} or $content =~ m[/\*\*]
$opts->{"code"} $content =~ m[/\*\*]
Truth table100%3/3
A or B
A= $opts->{"code"}B= $content =~ m[/\*\*]
ABresult
1X1
011
000
208 {
209 # No javadoc included...
210 4 return "";
211 }
212  
213 16 my @out;
214 16 my @parts = split /($comment_re)/, $content;
215 #_diag($opts, "Got ".@parts." parts in ".length($content)." characters\n");
216  
217 16 my $over = 0;
218 16 my $inapi = 0;
219 16 foreach my $i (0..$#parts)
220 {
221 79 ▶ if ($i < $#parts && $parts[$i] =~ /^\/\*\*/)
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $#parts and $parts[$i] =~ m[^/\*\*]) 32 47 79
Condition100%3/3
$i < $#parts and $parts[$i] =~ m[^/\*\*]
!ll&&!rl&&r
143332
MC/DC100%2/2
$i < $#parts and $parts[$i] =~ m[^/\*\*]
$i < $#parts $parts[$i] =~ m[^/\*\*]
Truth table100%3/3
A and B
A= $i < $#partsB= $parts[$i] =~ m[^/\*\*]
ABresult
0X0
100
111
222 {
223 # exclude comments like /** foo **/
224 32 ▶ next if ($parts[$i] =~ /^\/\*\*+[^\n\*]*\*+\//);
Branch: 1 branch
BranchTrueFalseTotal
if $parts[$i] =~ m[^/\*\*+[^\n\*]*\*+/] 1 31 32
225
226 31 my $comment = $parts[$i];
227
228 # Remove comment open and close
229 31 $comment =~ s/^\/\*\s*//;
230 31 $comment =~ s/\s*\*\/$//;
231
232 # Unindent the comment lines
233 31 $comment =~ s/^\s*\*[ \t]?//gm;
234
235 # Convert {@code foobar} to C<foobar>
236 31 $comment =~ s/\{\@code\s+([^\}]+)\}/C<$1>/gs;
237
238
239 31 ▶ if ($parts[$i+1] &&
Branch: 3 branches
BranchTrueFalseTotal
if ($parts[$i + 1] and $parts[$i + 1] =~ /^\s*(?:class|interface)\s+([^\s;]+)/) { } 11 20 31
elsif ($parts[$i + 1] and $parts[$i + 1] =~ /^\s*((?:public|private)\s+|)(static\s+|)function\s+(\w+)\s*\(([^\)]*)\)(:\w+|)/) { } 6 14 20
elsif ($parts[$i + 1] and $parts[$i + 1] =~ /^\s*((?:public|private)\s+|)(static\s+|)var\s+(\w+)(:\w+|)(\s*=\s*[^;]+|)/) { } 12 2 14
Condition66%2/3
$parts[$i + 1] and $parts[$i + 1] =~ /^\s*(?:class|interface)\s+([^\s;]+)/
!ll&&!rl&&r
02011
MC/DC50%1/2
$parts[$i + 1] and $parts[$i + 1] =~ /^\s*(?:class|interface)\s+([^\s;]+)/
$parts[$i + 1] $parts[$i + 1] =~ /^\s*(?:class|interface)\s+([^\s;]+)/
Truth table66%2/3
A and B
A= $parts[$i + 1]B= $parts[$i + 1] =~ /^\s*(?:class|interface)\s+([^\s;]+)/
ABresult
0X0
100
111
240 $parts[$i+1] =~ /^\s*(?:class|interface)\s+([^\s;]+)/)
241 {
242 11 my $class = $1;
243 11 _diag($opts, "Class: $class\n");
244
245 11 my $descrip = "";
246 11 my $name = _get_name(\$comment);
247 11 my $license = _get_license(\$comment);
248 11 my $author = _get_author(\$comment);
249 11 my $sees = _get_sees(\$comment);
250 11 ▶ if ($comment =~ /\S/)
Branch: 1 branch
BranchTrueFalseTotal
if ($comment =~ /\S/) 4 7 11
251 {
252 4 $descrip = "=head1 DESCRIPTION\n\n$comment\n\n";
253 }
254 11 $comment = "$name$descrip$sees$license$author";
255
256 11 $inapi = 0;
257 }
258 ▶ elsif ($parts[$i+1] &&
Condition66%2/3
$parts[$i + 1] and $parts[$i + 1] =~ /^\s*((?:public|private)\s+|)(static\s+|)function\s+(\w+)\s*\(([^\)]*)\)(:\w+|)/
!ll&&!rl&&r
0146
MC/DC50%1/2
$parts[$i + 1] and $parts[$i + 1] =~ /^\s*((?:public|private)\s+|)(static\s+|)function\s+(\w+)\s*\(([^\)]*)\)(:\w+|)/
$parts[$i + 1] $parts[$i + 1] =~ /^\s*((?:public|private)\s+|)(static\s+|)function\s+(\w+)\s*\(([^\)]*)\)(:\w+|)/
Truth table66%2/3
A and B
A= $parts[$i + 1]B= $parts[$i + 1] =~ /^\s*((?:public|private)\s+|)(static\s+|)function\s+(\w+)\s*\(([^\)]*)\)(:\w+|)/
ABresult
0X0
100
111
259 $parts[$i+1] =~ /^\s*((?:public|private)\s+|)(static\s+|)function\s+(\w+)\s*\(([^\)]*)\)(:\w+|)/)
260 {
261 6 my $private = $1;
262 6 my $static = $2;
263 6 my $fname = $3;
264 6 my $args = $4;
265 6 my $ftype = $5;
266 6 $private = $private =~ /private/;
267 6 $static = $static =~ /static/;
268
269 6 ▶ if (!$inapi)
Branch: 1 branch
BranchTrueFalseTotal
unless ($inapi) 0 6 6
270 {
271 0 $inapi = 1;
272 0 $parts[$i-1] .= "/*\n\n=head1 API\n\n=cut\n*/\n";
273 0 push @out, "=head1 API\n\n";
274 }
275 6 ▶ if (!$over)
Branch: 1 branch
BranchTrueFalseTotal
unless ($over) 0 6 6
276 {
277 0 $over++;
278 0 $parts[$i-1] .= "/*\n\n=over\n\n=cut\n*/\n";
279 0 push @out, "=over\n\n";
280 }
281
282 6 ▶ _diag($opts, "Function: ".($private?"private ":"").($static?"static ":"")."function $fname($args)$ftype\n");
Branch: 2 branches
BranchTrueFalseTotal
$private ? : 3 3 6
$static ? : 3 3 6
283
284 6 my ($paramlist, $params) = _get_params(\$comment);
285 6 my $returns = _get_returns(\$comment);
286 6 my $sees = _get_sees(\$comment);
287
288 6 $comment = "=item $fname$paramlist\n\n$params$comment\n\n$returns$sees";
289 }
290 ▶ elsif ($parts[$i+1] &&
Condition66%2/3
$parts[$i + 1] and $parts[$i + 1] =~ /^\s*((?:public|private)\s+|)(static\s+|)var\s+(\w+)(:\w+|)(\s*=\s*[^;]+|)/
!ll&&!rl&&r
0212
MC/DC50%1/2
$parts[$i + 1] and $parts[$i + 1] =~ /^\s*((?:public|private)\s+|)(static\s+|)var\s+(\w+)(:\w+|)(\s*=\s*[^;]+|)/
$parts[$i + 1] $parts[$i + 1] =~ /^\s*((?:public|private)\s+|)(static\s+|)var\s+(\w+)(:\w+|)(\s*=\s*[^;]+|)/
Truth table66%2/3
A and B
A= $parts[$i + 1]B= $parts[$i + 1] =~ /^\s*((?:public|private)\s+|)(static\s+|)var\s+(\w+)(:\w+|)(\s*=\s*[^;]+|)/
ABresult
0X0
100
111
291 $parts[$i+1] =~ /^\s*((?:public|private)\s+|)(static\s+|)var\s+(\w+)(:\w+|)(\s*=\s*[^;]+|)/)
292 {
293 12 my $private = $1;
294 12 my $static = $2;
295 12 my $vname = $3;
296 12 my $vtype = $4;
297 12 my $default = $5;
298 12 $private = $private =~ /private/;
299 12 $static = $static =~ /static/;
300
301 12 $default =~ s/^\s*=\s*//;
302 12 ▶ if ($default ne "")
Branch: 1 branch
BranchTrueFalseTotal
if ($default ne "") 6 6 12
303 {
304 6 $default = "B<Default value:> $default\n\n";
305 }
306
307 12 ▶ if (!$inapi)
Branch: 1 branch
BranchTrueFalseTotal
unless ($inapi) 3 9 12
308 {
309 3 $inapi = 1;
310 3 $parts[$i-1] .= "/*\n\n=head1 API\n\n=cut\n*/\n";
311 3 push @out, "=head1 API\n\n";
312 }
313 12 ▶ if (!$over)
Branch: 1 branch
BranchTrueFalseTotal
unless ($over) 3 9 12
314 {
315 3 $over++;
316 3 $parts[$i-1] .= "/*\n\n=over\n\n=cut\n*/\n";
317 3 push @out, "=over\n\n";
318 }
319
320 12 ▶ _diag($opts, "Var: ".($private?"private ":"").($static?"static ":"")."var $vname$vtype\n");
Branch: 2 branches
BranchTrueFalseTotal
$private ? : 3 9 12
$static ? : 3 9 12
321
322 12 my ($paramlist, $params) = _get_params(\$comment);
323 12 my $returns = _get_returns(\$comment);
324 12 my $sees = _get_sees(\$comment);
325
326 12 $comment = "=item $vname$paramlist\n\n$params$comment\n\n$default$returns$sees";
327 }
328 else
329 {
330 2 carp("Unhandled comment type\n");
331 }
332
333 30 ▶ if ($comment =~ /^=/)
Branch: 1 branch
BranchTrueFalseTotal
if ($comment =~ /^=/) 29 1 30
334 {
335 29 $comment =~ s/\n\n\n+/\n\n/gs;
336 29 $parts[$i] = "/*\n\n$comment=cut\n*/";
337 29 push @out, $comment;
338 }
339
340 30 ▶ if ($parts[$i] =~ /^\s*(\@\w*)/m)
Branch: 1 branch
BranchTrueFalseTotal
if ($parts[$i] =~ /^\s*(\@\w*)/m) 1 29 30
341 {
342 #carp("Unhandled $1 in \n$comment\n");
343 1 carp("Unhandled $1\n");
344 }
345 }
346 }
347 14 ▶ if ($over > 0)
Branch: 1 branch
BranchTrueFalseTotal
if ($over > 0) 3 11 14
348 {
349 3 push @parts, "/*\n\n";
350 3 for (1..$over)
351 {
352 3 push @parts, "=back\n\n";
353 3 push @out, "=back\n\n";
354 }
355 3 push @parts, "=cut\n*/\n";
356 }
357
358 14 ▶ if (!$opts->{code} && @out == 0)
Branch: 1 branch
BranchTrueFalseTotal
if (not $opts->{"code"} and @out == 0) 2 12 14
Condition100%3/3
not $opts->{"code"} and @out == 0
!ll&&!rl&&r
392
MC/DC100%2/2
not $opts->{"code"} and @out == 0
not $opts->{"code"} @out == 0
Truth table100%3/3
not(A) and B
A= not $opts->{"code"}B= @out == 0
ABresult
0X0
100
111
359 {
360 # No POD to emit
361 2 return "";
362 }
363 12 ▶ return join("", $opts->{code} ? @parts : @out);
Branch: 1 branch
BranchTrueFalseTotal
$opts->{'code'} ? : 3 9 12
364 }
365  
366 ###############################################
367  
368 # Extracts @param tags from comments
369 sub _get_params
370 18 ▶{
Subroutine _get_params: called CC=3 SCAR=11.0
371 18 my $R_comment = shift;
372  
373 18 my $paramlist = "";
374 18 my $params = "";
375 18 ▶ while ($$R_comment =~ s/\n?[ \t]*\@param[ \t]+(\w+)(?:[ \t]*:)?[ \t]+([^\n]+)(?:\n|$)/\n/s)
Branch: 1 branch
BranchTrueFalseTotal
if ($$R_comment =~ s/\n?[ \t]*\@param[ \t]+(\w+)(?:[ \t]*:)?[ \t]+([^\n]+)(?:\n|$)/\n/s) 6 18 24
376 {
377 6 my $pname = $1;
378 6 my $pdesc = $2;
379 6 ▶ $paramlist .= ($paramlist ? "," : "") . " $pname";
Branch: 1 branch
BranchTrueFalseTotal
$paramlist ? : 3 3 6
380 #$params .= "=item $pname\n\n$pdesc\n\n";
381 6 $params .= "B<$pname>: $pdesc\n\n";
382 }
383 #if ($params)
384 #{
385 # $params = "B<Parameters:>\n\n=over\n\n" . $params . "=back\n\n";
386 #}
387 18 return ($paramlist, $params);
388 }
389  
390 # Extracts @returns tags from comments
391 sub _get_returns
392 18 ▶{
Subroutine _get_returns: called CC=2 SCAR=6.9
393 18 my $R_comment = shift;
394  
395 18 my $returns = "";
396 18 ▶ while ($$R_comment =~ s/\n?[ \t]*\@returns?[ \t]+([^\n]+)(?:\n|$)/\n/s)
Branch: 1 branch
BranchTrueFalseTotal
if ($$R_comment =~ s/\n?[ \t]*\@returns?[ \t]+([^\n]+)(?:\n|$)/\n/s) 3 18 21
397 {
398 3 my $rdesc = $1;
399 3 $returns .= "B<Returns:> $rdesc\n\n";
400 }
401 18 return $returns;
402 }
403  
404 # Extracts @see tags from comments
405 sub _get_sees
406 29 ▶{
Subroutine _get_sees: called CC=2 SCAR=6.9
407 29 my $R_comment = shift;
408  
409 29 my $sees = "";
410 29 ▶ while ($$R_comment =~ s/\n?[ \t]*\@see[ \t]+([^\n]+)(?:\n|$)/\n/s)
Branch: 1 branch
BranchTrueFalseTotal
if ($$R_comment =~ s/\n?[ \t]*\@see[ \t]+([^\n]+)(?:\n|$)/\n/s) 3 29 32
411 {
412 3 my $sdesc = $1;
413 3 $sees .= "B<See Also:> $sdesc\n\n";
414 }
415 29 return $sees;
416 }
417  
418 # Extracts @author tags from comments
419 sub _get_author
420 11 ▶{
Subroutine _get_author: called CC=2 SCAR=6.9
421 11 my $R_comment = shift;
422  
423 11 my $author = "";
424 11 ▶ while ($$R_comment =~ s/\n?[ \t]*\@author[ \t]+([^\n]+)(?:\n|$)/\n/s)
Branch: 1 branch
BranchTrueFalseTotal
if ($$R_comment =~ s/\n?[ \t]*\@author[ \t]+([^\n]+)(?:\n|$)/\n/s) 10 11 21
425 {
426 10 my $adesc = $1;
427 10 $author .= "=head1 AUTHOR\n\n$adesc\n\n";
428 }
429 11 return $author;
430 }
431  
432 # Extracts @license tags from comments
433 sub _get_license
434 11 ▶{
Subroutine _get_license: called CC=2 SCAR=6.9
435 11 my $R_comment = shift;
436  
437 11 my $license = "";
438 11 ▶ while ($$R_comment =~ s/\n?[ \t]*\@license[ \t]*(.*?)(\n[ \t]*\@|$)/$2/s)
Branch: 1 branch
BranchTrueFalseTotal
if ($$R_comment =~ s/\n?[ \t]*\@license[ \t]*(.*?)(\n[ \t]*\@|$)/$2/s) 3 11 14
439 {
440 3 my $adesc = $1;
441 3 $license .= "=head1 LICENSE\n\n$adesc\n\n";
442 }
443 11 return $license;
444 }
445  
446 # Extracts =head1 NAME from comments
447 sub _get_name
448 11 ▶{
Subroutine _get_name: called CC=2 SCAR=6.9
449 11 my $R_comment = shift;
450  
451 11 my $name = "";
452 11 ▶ if ($$R_comment =~ s/^\n*([\w\.]+)[ \t]+\-[ \t]+([^\n]+)(?:\n+|$)//s)
Branch: 1 branch
BranchTrueFalseTotal
if ($$R_comment =~ s/^\n*([\w\.]+)[ \t]+\-[ \t]+([^\n]+)(?:\n+|$)//s) 3 8 11
453 {
454 3 my $title = $1;
455 3 my $desc = $2;
456 3 $name = "=head1 NAME\n\n$title - $desc\n\n";
457 }
458 11 return $name;
459 }
460  
461 sub _diag
462 29 ▶{
Subroutine _diag: called CC=2 SCAR=7.1
463 29 my $opts = shift;
464 29 my $msg = shift;
465  
466 29 ▶ warn $msg if ($opts->{verbose});
Branch: 1 branch
BranchTrueFalseTotal
if $opts->{"verbose"} 0 29 29
467 }
468  
469 2 1;
470  
471 __END__
↑ Summary