我怎样才能摆脱 Perl 的 Pod 的空行,这样它们就不会出现在 Pod::Usage 中?
我有以下与 getopt::long: 一起使用的 pod
=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
,当我提供 -h 时它会产生:
Usage: foo [OPTION]... [URL]... Options: -h, --help Print a brief help message and exits. -i, --input=FILE Reads from FILE
我的问题是:如何删除 -h 和 -i 之间的空行?
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 ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Pod::Usage
仅调用 Pod 格式化程序(例如perldoc
或Text::Pod
)来从 Pod 生成使用消息。您编写的 Pod 代码将被这些工具格式化为几行空行。如果您不需要这些,请编写不同的 Pod。例如,不幸的是,当转换为其他格式(例如 HTML)时,它看起来不太好,并且您将失去选项及其描述的良好垂直对齐。然而,由于
Pod::Usage
实际上是用于命令行程序的,因此优化终端上文本的可读性似乎是合理的,而不是让 HTML 或类似内容看起来不错。Pod::Usage
just calls a Pod formatter likeperldoc
orText::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 exampleUnfortunately 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.