Perl POD document


Release date:2023-10-21 Update date:2023-10-21 Editor:admin View counts:132

Label:

Perl POD document

POD (Plain Old Documentation) documents can be embedded in a module or script in Perl.

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

Rules for the use of POD documents:

POD documents to =head1 start, =cut end, =head1 front vs. =cut add a blank line after.

Perl ignores POD . The document in the. Examples are as follows:

Example

#/ Usr/bin/perlprint "Hello, World n"= Head1Hello, World instance, this is a
A simple example of Perl= Cutprint "Hello, Runoob n";

Execute the above program, and the output is as follows:

Hello, World
Hello, Runoob

We can also use "__END__" or "__DATA__" “comment” everythingafter the line:

Example

#/ Usr/bin/perlprint "Hello,
World n "; while (<DATA>) {print $ _;} __END_ _=head1Hello, World instance
This is a simple example of Perl. Print "Hello, Runoob n";

Execute the above program, and the output is as follows:

Hello, World

=Head1 Hello, World instance
This is a simple example of Perl.
Print "Hello, Runoob n";

The following example does not read the POD document:

Example

#/ Usr/bin/perlprint "Hello, World n"\__ END_\_= Head1Hello, World instance
This is a simple example of Perl. Print "Hello, Runoob n";

Execute the above program, and the output is as follows:

Hello, World

What is POD?

Pod (Plain Old Documentation), a simple and easy-to-use markup language (markup language), is often used for document writing in perl programs and modules.

The converter of Pod can convert Pod into various formats, such as text, html , man , and so on.

Pod markup language consists of three basic types: plain, original, and command.

  • Ordinary paragraphs: you can use formatting code in ordinary paragraphs, such as boldface, italics, or code style, underlining, etc.

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

  • Command paragraph: the command paragraph acts on the entire document and is usually used for title setting or list markup. All command paragraphs (he isonly one line in length) are used "=" first, then an identifier. Subsequent text will be affected by this command. Commands that are now widely used include

=Pod (Start Document)
=Head1 Title Text
=Head2 Title Text
=Head3 Title Text
=Head4 Title Text
=Number of indented spaces over
=Item prefix
=Back (End List)
=Begin Document Format
=End Document Format
=For formatted text
=Encoding encoding type
=Cut (end of document)

In perl, you can use the pod2html.pod >.html to generate pod documents in html format.

Consider the following POD instance:

Example

=beginhtml =encoding utf-8 =head1 Novice Tutorial=cut

pod2html will be copied in the original text.

Use pod2html command execution, converting it to HTML code:

$ pod2html test.pod > test.html

Open in a browser test.html , the link section is the index, which is shown as follows:

Image0

The following example is written directly in the POD document HTML :

=begin html
=encoding utf-8

<h1>Novice Tutorial</h1>
<p> www.runoob.com </p>

=end html

pod2html will be copied in the original text.

Use pod2html command execution, converting it to HTML code:

$ pod2html test.pod > test.html

Open in a browser test.html , the link section is the index, which is shown as follows:

Image1

Powered by TorCMS (https://github.com/bukun/TorCMS).