gpt4 book ai didi

perldoc 不显示节之间的文本

转载 作者:行者123 更新时间:2023-12-01 22:49:58 26 4
gpt4 key购买 nike

我有这个 POD 文件:

=head1 Create professional slideshows with Mojolicious::Plugin::RevealJS


=head2 Install and run a Mojolicious server

Santa's elf had a problem. He had to write very fast a presentation and show it to a bunch of new elf's.
The email assigning this to him was sent by Santa himself.
The elf started to look on Metacpan and found this module: L<Mojolicious::Plugin::RevealJS|https://metacpan.org/pod/Mojolicious::Plugin::RevealJS>

He quickly typed the following commands:

C<cpanm Mojolicius Mojolicious::Plugin::RevealJS>

Now he could generate an mojo lite app using:

C<mojo generate lite-app slide_show>

Because the elf was trained in the ancient arts of the elders
he cloud open new file with vim and paste this code in:

=begin perl

use Mojolicious::Lite -signatures;

app->static->paths(['.']);

plugin 'RevealJS';

any '/' => { template => 'presentation', layout => 'revealjs' };

app->start;

=end perl

当我运行 perldoc t.pod 时,“=begin perl”和“=end perl”之间的代码不可见。我不明白我做错了什么。

最佳答案

perlpod documentation说……

For, begin, and end will let you have regions of text/code/data that are not generally interpreted as normal Pod text, but are passed directly to particular formatters, or are otherwise special. A formatter that can use that format will use the region, otherwise it will be completely ignored.

在这种情况下,格式化程序perldoc 用来将您的 POD 呈现为文本的东西。我怀疑它不知道如何处理 perl 格式,所以它忽略了它。

生成 HTML 的格式化程序可能知道如何处理 perl 格式,并可能将其替换为具有语法高亮显示的代码块。

如果您希望 POD 中的代码示例始终显示为代码,请使用 verbatim paragraph反而。这是通过在前面添加缩进来完成的。


=head2 frobnicate($foo)

This function frobnicates the C<$foo>.

my $bar = frobnicate($foo)

=cut

sub frobnicate { ... }

关于perldoc 不显示节之间的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74575867/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com