Open In App

Plain Old Text Documentation in Perl Programming

Last Updated : 01 Jun, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

POD is a  markup language used for writing documentation for Perl, Perl programs, and Perl modules. It is simple to use.

There are various translators available for converting Pod to different formats such as plain text, HTML, man pages, and more. Pod markup comprises of three  kinds of paragraphs :

  • Ordinary Paragraph: For bold, italic, code-style, hyperlinks, and more use formatting code in ordinary graph
  • Verbatim Paragraph: Code block or other text which does not require any special parsing or formatting  are implemented using, and these should not be wrapped too.
  • Command Paragraph: A command paragraph is used for chunks of text, usually used as headings or parts of lists. Command paragraphs start with =, followed by an identifier and an arbitrary text

To embed Pod (Plain Old Text) documentation in Perl modules and scripts  , use embedded documentation in your Perl Code by using following rules:

  • Start your documentation with an empty line
  • Place a =head1′ command at the beginning 
  • Place a=cut’  command at end

Note : Perl will ignore the Pod (Plain Old Text) text you entered in the code

Example:

=head1 SYNOPSIS
 [GEEKSFORGEEKS].
=cut

Following mentioned  is a simple example of using embedded documentation inside your Perl code 




#!/usr/bin/perl
  
print "Hello, World\n";
  
=head1 Hello, World Example
This example demonstrate very basic syntax of Perl.
=cut
  
print "Hello, geeksforgeeks\n"


Output: 

Hello, World
Hello, geeksforgeeks

If Pod is put  at the end of the file, and you are  using an __END__ or __DATA__ cut mark, then  make sure  that you put an empty line before the first Pod command, otherwise without an empty line before the =head1, many translators will not  recognize the =head1 as starting a Pod block.




#!/usr/bin/perl
  
print "Hello, World\n";
  
while(<DATA>) {
  print $_;
}
  
__END__
  
=head1 Hello, World Example
This example demonstrate very basic syntax of Perl.
print "Hello, geeksforgeeks\n";


Output:

Hello, World

=head1 Hello, World Example
This example demonstrate very basic syntax of Perl.
print "Hello, geeksforgeeks\n";


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads