views:

58

answers:

1

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

=head1 SYNOPSIS

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

=head1 OPTIONS

=over 20

=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 ?

+6  A: 

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.

rafl