Module PODs

The documentation for Perl modules is written in a simple markup language called POD (Plain Old Documentation).

This page shows how to write a POD for a Perl module. If you adhere to this style, then it will be easier for others to read and understand your documentation.

h2xs puts a skeleton POD at the end of the .pm file that it writes. Read the PODs in existing modules for additional examples.

=head1 NAME

Geometry::Circle - manages a circle
The NAME section gives the name of the module and a one-line description.



  use Geometry::Circle

  $circle  = new Geometry::Circle $x, $y, $r

  ($x, $y) = $circle->center;
  $radius  = $circle->radius;
  $area    = $circle->area

  $pi      = $Geometry::Circle::PI;
The SYNOPSIS section shows the essential steps in using the module: the use statement, any subroutines, class methods or variables, and all object methods. Method calls should indicate their parameters and return values.

Indent each line in the synopsis. This makes it a verbatim paragraph, and ensures that your alignment will be preserved.


Perl5.8.8, Exporter, Geometry::Point
The REQUIRES section tells the user what they will need in order to use the module.
=head1 EXPORTS

The EXPORTS section tells the user what the module will do to their namespace if they use it.

Geometry::Circle manages circles.  
Methods are provided for creating 
circles and computing their areas.
This is a description of the module.


  • What does it do for the user?
  • How do you use it?
  • What objects does it support?
  • What methods does it provide?
=head1 METHODS

=head2 Creation

=over 4

=item new Geometry::Circle $x, $y, $radius

Creates and returns a 
new Geometry::Circle object 
with center ($x, $y) and radius $radius.


=head2 Access

=over 4

=item $circle->center

Returns a list of the x,y coordinates 
of the center of the circle.

In scalar context, 
returns an array reference.

=item $circle->radius

Returns the radius of the circle.

=item $circle->area

Returns the area of the circle.

The METHODS section lists and describes each method in the class.

You may further organize methods under level-2 headings, such as Creation, Access and Utility.


=over 4

=item $Geometry::Circle::PI

The ratio of the circumference 
of a circle to its diameter.

The CLASS VARIABLES section lists any package variables in the API.

=over 4

=item Negative radius

(F) A circle may not be created with a negative radius.

The DIAGNOSTICS section gives the text of every error message the the module may generate, and explains its meaning.

Error messages are classified as follows:

A warning (optional)
A deprecation (optional)
A severe warning (mandatory)
A fatal error (trappable)
A very fatal error (non-trappable)
=head1 AUTHOR

A. U. Thor, a.u.thor@a.galaxy.far.far.away
You should include your name and email address, in case anyone needs to contact you regarding the module.
=head1 SEE ALSO

perl(1), Geometry::Square
This is the usual list of related programs and modules.
The =cut line denotes the end of POD text.




Bulgarian translation courtesy of All Science

Italian Translation courtesy of Search-Sos

Steven W. McDougall / resume / / 1997 June 2