I have this POD:
=head1 My code
=head2 check
Checks something.
Parameters:
=over 8
=item what to check.
=back
=cut
podchecker
doesn't complain. perldoc
shows this:
My code
check
Checks something.
Parameters:
what to check.
I expected the "what to check" line to be indented further.
How do I need to change my POD to show parameters indented?
Is there a better way to do this than with =item
s?
Both perldoc
and pod2html
ignore the indentlevel. Use bullets as a workaround. See an example below.
=head1 My code
=head2 check with no bullets or numbers
Checks something.
Parameters:
=over
=item what to check A
=item what to check B
=back
=head2 check with bullets
Checks something.
=over
=item * what to check A
=item * what to check B
=back
=head2 check with numbers
Checks something.
=over
=item 1. what to check A
=item 2. what to check B
=back
=cut
Running perldoc /path/to/script.pl
results in this:
My code
check with no bullets or numbers
Checks something.
Parameters:
what to check A
what to check B
check with bullets
Checks something.
o what to check A
o what to check B
check with numbers
Checks something.
1. what to check A
2. what to check B
REFERENCES:
The indentlevel option to "=over" indicates how far over to indent, generally in ems (where one em is the width of an "M" in the document's base font) or roughly comparable units; if there is no indentlevel option, it defaults to four. (And some formatters may just ignore whatever indentlevel you provide.)
(From perldoc perlpod
, boldface mine)
Please study my template code, you will require to have Getopt::Long
and Pod::Usage
installed.
You will be able to run this script with options --man
and --help
to generate brief and full documentation.
#!/usr/bin/perl
#
# Description:
# Describe purpose of the program
#
# Parameters:
# Describe parameters purpose
#
# Date: Tue Nov 29 1:18:00 UTC 2019
#
# Author: Polar Bear
# https://stackoverflow.com/users/12313309/polar-bear
#
use strict;
use warnings;
use Getopt::Long qw(GetOptions);
use Pod::Usage;
use Data::Dumper;
my %opt;
my @args = (
'input|i=s',
'output|o=s',
'debug|d',
'help|?',
'man|m'
);
GetOptions( \%opt, @args ) or pod2usage(2);
print Dumper(\%opt) if $opt{debug};
pod2usage(1) if $opt{help};
pod2usage(-exitval => 0, -verbose => 2) if $opt{man};
pod2usage("$0: No files given.") if ((@ARGV == 0) && (-t STDIN));
__END__
=head1 NAME
program - brief on program's purpose
=head1 SYNOPSIS
program.pl [options] file(s)
Options:
-i,--input input filename
-o,--output output filename
-d,--debug output debug information
-?,--help brief help message
-m,--man full documentation
=head1 OPTIONS
=over 4
=item B<-i,--input>
Input filename
=item B<-o,--output>
Output filename
=item B<-d,--debug>
Print debug information.
=item B<-?,--help>
Print a brief help message and exits.
=item B<--man>
Prints the manual page and exits.
=back
=head1 DESCRIPTION
B<This program> accepts B<input> and processes to B<output> with purpose of achiving some goal.
=head1 EXIT STATUS
The section describes B<EXIT STATUS> codes of the program
=head1 ENVIRONMENT
The section describes B<ENVIRONMENT VARIABLES> utilized in the program
=head1 FILES
The section describes B<FILES> which used for program's configuration
=head1 EXAMPLES
The section demonstrates some B<EXAMPLES> of the code
=head1 REPORTING BUGS
The section provides information how to report bugs
=head1 AUTHOR
The section describing author and his contanct information
=head1 ACKNOWLEDGMENT
The section to give credits people in some way related to the code
=head1 SEE ALSO
The section describing related information - reference to other programs, blogs, website, ...
=head1 HISTORY
The section gives historical information related to the code of the program
=head1 COPYRIGHT
Copyright information related to the code
=cut
Man page script.pl --man
NAME
program - brief on program's purpose
SYNOPSIS
program.pl [options] file(s)
Options:
-i,--input input filename
-o,--output output filename
-d,--debug output debug information
-?,--help brief help message
-m,--man full documentation
OPTIONS
-i,--input
Input filename
-o,--output
Output filename
-d,--debug
Print debug information.
-?,--help
Print a brief help message and exits.
--man
Prints the manual page and exits.
DESCRIPTION
This program accepts input and processes to output with purpose of
achiving some goal.
EXIT STATUS
The section describes EXIT STATUS codes of the program
ENVIRONMENT
The section describes ENVIRONMENT VARIABLES utilized in the program
FILES
The section describes FILES which used for program's configuration
EXAMPLES
The section demonstrates some EXAMPLES of the code
REPORTING BUGS
The section provides information how to report bugs
AUTHOR
The section describing author and his contanct information
ACKNOWLEDGMENT
The section to give credits people in some way related to the code
SEE ALSO
The section describing related information - reference to other
programs, blogs, website, ...
HISTORY
The section gives historical information related to the code of the
program
COPYRIGHT
Copyright information related to the code
Help page script.pl --help
program.pl [options] file(s)
Options:
-i,--input input filename
-o,--output output filename
-d,--debug output debug information
-?,--help brief help message
-m,--man full documentation
Options:
-i,--input
Input filename
-o,--output
Output filename
-d,--debug
Print debug information.
-?,--help
Print a brief help message and exits.
--man
Prints the manual page and exits.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With