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 :

  • 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 

filter_none

edit
close

play_arrow

link
brightness_4
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"

chevron_right


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.

filter_none

edit
close

play_arrow

link
brightness_4
code

#!/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";

chevron_right


Output:

Hello, World

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



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.