Open In App

Plain Old Text Documentation in Perl Programming

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 :



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

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";

Article Tags :