Wednesday, July 14, 2010

Using Pod

Very short descriptive notes:
All pod commands to be preceded by one line.

a) =head1, =head2 - Different levels of heading with separate indent levels
b) =over n - n is number of spaces to indent list by
c) =item * - bullets
=item 1. - numbered list
=item foo - list
d) =back - decrease indent level back
e) Formatting codes have a capital letter, followed by <, followed by text, followed by >
Text coding styles:
I<..> - italic
B<..> - Bold
C<..> - code
F<..> - Filename
S<..> - contains non-breaking spaces
===========================================================
Example 1: Best practice to include pod into code.


=head1 NAME

An example package

=head1 METHODS

=head2 eg

Returns the string "example".

=cut

sub eg {
return ";
}

=head2 lipsum

Returns the string "lipsum".

=cut

sub lipsum {
return "lorem ipsum";
}

==========================================================
Example 2: Illustrating all commands of pod

=head1 NAME
Toolname - A simple one line description about tool

=head1 SYNOPSIS

Toolname [options] [parameters]

=head1 OPTIONS

=over

=item --option1

Description about option1

=item B<--option2> #B will bold the option when perldoc

Desc about option2

=item * option3

description for option3.

=back

=head1 AUTHOR
ravic@

=cut

pod2usage(-verbose=>1); #will print synopsis and options
pod2usage(); #Will Just print synopsis

References:
http://www.indecorous.com/perl/pod/
perldoc perlpod
perldoc perlpodspec
perldoc Pod::Simple

Thanks,
--RC