blib/lib/App/generate_pods.pl untested

filter: Statementstmt 0.0% 0 / 25 Branchbran n/a Conditioncond 0.0% 0 / 2 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 32 CC 1 SCAR 6.9
CC
1
Cov
0%
generate_pod
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #!/usr/bin/env perl
2  
3 use strict;
4 use warnings;
5  
6 use File::Basename qw(basename);
7  
8 $ENV{'PERL5LIB'} .= ':lib';
9  
10 # Don't let the actual terminal size affect POD every time we generate it.
11 # LINES isn't used by us, but is required for Term::ReadKey::GetTerminalSize()
12 # to use COLUMNS.
13 $ENV{'COLUMNS'} = 80;
14 $ENV{'LINES'} = 50;
15  
16 generate_pod($_) for grep { not /recs-operation/ } <bin/recs-*>;
17  
18 sub generate_pod {
19 my $script = shift;
20  
21 print "Generating pod documentation for $script\n";
22  
23 my $script_base = basename($script);
24  
25 my @help = `$^X $script --help-all 2>/dev/null`;
26  
27 open(my $fh, '>', "doc/$script_base.pod") or die "Could not open doc/$script_base.pod: $!";
28  
29 print $fh <<HEADER;
30 =head1 NAME
31  
32 $script_base
33  
34 =head1 $script_base --help-all
35  
36 HEADER
37  
38 foreach my $line (@help) {
39 print $fh " " . $line;
40 }
41  
42 print $fh <<FOOTER;
43  
44 =head1 SEE ALSO
45  
46 =over
47  
48 =item * See L<App::RecordStream> for an overview of the scripts and the system
49  
50 =item * Run C<recs examples> or see L<App::RecordStream::Manual::Examples> for a set of simple recs examples
51  
52 =item * Run C<recs story> or see L<App::RecordStream::Manual::Story> for a humorous introduction to RecordStream
53  
54 =item * Every command has a C<--help> mode available to print out usage and
55 examples for the particular command, just like the output above.
56  
57 =back
58  
59 FOOTER
60  
61 close $fh;
62 }