开发者

How can I get rid of empty lines Perl's Pod so they don't show up with Pod::Usage?

开发者 https://www.devze.com 2023-01-19 20:44 出处:网络
I have following pod which I used with getopt::long: =head1 SYNOPSIS foo [OPTION]... [URL]... =head1 OPTIONS

I have following pod which I used with getopt::long:

=head1 SYNOPSIS

foo [OPTION]... [URL]...

=head1 OPTIONS

=over 20

开发者_JS百科=item B<-h, --help>

Print a brief help message and exits.

=item B<-i, --input=FILE>

Reads from FILE

=back

=cut

and when I provides -h it produces:

Usage:
    foo [OPTION]... [URL]...

Options:
    -h, --help          Print a brief help message and exits.

    -i, --input=FILE    Reads from FILE

My question is: how can I remove empty line between -h and -i ?


Pod::Usage just calls a Pod formatter like perldoc or Text::Pod to generate the usage messages from your Pod. The Pod code you've written will be formatted with a couple of empty lines by those tools. If you don't want those, write different Pod. For example

=over 4

=item B<-h>                     Print a brief help message and exits.

=item B<-i>, B<--input=FILE>    Reads from FILE

=back

Unfortunately that won't look as nice when being converted into other formats such as HTML, and you're losing the nice vertical alignment of options and their descriptions. However, as Pod::Usage is really intended for command-line programs, it seems to be reasonable to optimise for readability of text on a terminal instead of having things look good in HTML or similar.

0

精彩评论

暂无评论...
验证码 换一张
取 消