Perl POD documentation

POD documents can be embedded in modules or scripts in Perl.

POD is a simple and easy-to-use markup language (labeling language).

POD document usage rules:

The POD document starts with a line of s head1, ends with a cut, and adds an empty line before the head1 and after the cut.

Perl ignores the documents in the POD. Here's an example:

#!/usr/bin/perl

print "Hello, World\n";

=head1 Hello, World 实例
这是一个 Perl 的简单实例。
=cut

print "Hello, W3Cschool\n";

The above procedure is performed and the output is:

Hello, World
Hello, W3Cschool

We can also __END__ "comment" __DATA__ the contents of the line using """"

#!/usr/bin/perl

print "Hello, World\n";

while(<DATA>){
  print $_;
}

__END__

=head1 Hello, World 实例
这是一个 Perl 的简单实例。
print "Hello, W3Cschool\n";

The above procedure is performed and the output is:

Hello, World

=head1 Hello, World 实例
这是一个 Perl 的简单实例。
print "Hello, W3Cschool\n";

The following instances do not read POD documents:

#!/usr/bin/perl

print "Hello, World\n";

__END__

=head1 Hello, World 实例
这是一个 Perl 的简单实例。
print "Hello, W3Cschool\n";

The above procedure is performed and the output is:

Hello, World

What is a POD?

The Plain Old Documentation is a simple and easy-to-use markup language (labeling language) that is often used to write documents in perl programs and modules.

Pod converters convert Pods into many formats, such as text, html, man, and many more.

The Pod tag language consists of three basic types: Normal, Synth, and Command.

  • Normal paragraphs: You can use formatted code in normal paragraphs, such as bold, italic, or code style, underscore, and so on.

  • Original paragraph: The original paragraph, used for blocks of code or other parts that do not need to be processed by a converter, and does not require paragraph rearming.

  • Command paragraphs: Command paragraphs act on the entire document and are typically used for title settings or list markers.

    All command paragraphs (he has only one line of length) start with a """ and then an identifier. S ubsequent text will be affected by this command. Commands that are now widely used include

    =pod (开始文档)
    =head1 标题文本
    =head2 标题文本
    =head3 标题文本
    =head4 标题文本
    =over 缩进空格数量
    =item 前缀
    =back (结束列表)
    =begin 文档格式
    =end 结束文档格式
    =for 格式文本
    =encoding 编码类型
    =cut (文档结束)

In perl, you can use pod2html s.pod s.pod s.8.html to generate pod documents in html format.

Consider the following POD instances:

=begin html
=encoding utf-8

=head1 W3Cschool教程

=cut

This piece of code is copied in the original text when pod2html.

Use the pod2html command to execute and convert it to HTML code:

$ pod2html test.pod > test.html 

Open the test page in .html, and the link is partially indexed


The following instance writes HTML directly in the POD document:

=begin html
=encoding utf-8

<h1>W3Cschool教程</h1>
<p> www.w3cschool.cn </p>

=end html

This piece of code is copied in the original text when pod2html.

Use the pod2html command to execute and convert it to HTML code:

$ pod2html test.pod > test.html 

Open the test page in .html, and the link is partially indexed