Latest web development tutorials

Perl POD documentation

Perl can be embedded POD (Plain Old Documentation) in the module documentation or script.

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

POD documentation using rules:

POD documentation starts with= head1, = cutend, and before= head1= cut after adding a blank line.

Perl ignores the POD documentation. Examples are as follows:

#!/usr/bin/perl

print "Hello, World\n";

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

print "Hello, w3big\n";

The above program, the output is:

Hello, World
Hello, w3big

We can also use "__END__" or "__DATA__" after the contents of the line where all the "Comments" out:

#!/usr/bin/perl

print "Hello, World\n";

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

__END__

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

The above program, the output is:

Hello, World

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

The following examples are not read POD documentation:

#!/usr/bin/perl

print "Hello, World\n";

__END__

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

The above program, the output is:

Hello, World

What is POD?

Pod (Plain Old Documentation), is a simple and easy to use tag-based language (markup language), it is often used in perl programs and modules written in the document.

Pod Pod conversion can be converted into a variety of formats, such as text, html, man a lot and so on.

Pod markup consists of three basic basic types: normal, original, and commands.

  • Normal paragraph: You can use formatting codes in ordinary paragraphs, such as bold, italic, or coding style, underline.

  • Original paragraph: text passages, for part of the code block or other converter processing is not required, but does not require paragraph rearrangement.

  • Paragraph command: Command Paragraph role in the entire document or a list of commonly used to set the title tags.

    All command paragraphs (his only line length) using the "=" and then is an identifier. Subsequent text will be affected by this Order. Command is now widely used include

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

In perl, you can use pod2html **. Pod> **. Html to generate a html document pod format.

POD Consider the following examples:

=begin html
=encoding utf-8

=head1 本教程

=cut

This code will be the original copy when pod2html.

Use pod2html execute command to convert it to HTML code:

$ pod2html test.pod > test.html 

Open the browser test.html, links section for the index, is shown below:

The following examples are written directly in the POD documentation HTML:

=begin html
=encoding utf-8

<h1>本教程</h1>
<p> www.w3big.com </p>

=end html

This code will be the original copy when pod2html.

Use pod2html execute command to convert it to HTML code:

$ pod2html test.pod > test.html 

Open the browser test.html, links section for the index, is shown below: