YAPC::NA 2004 Perl Style Guides for Large Projects #37

Bonus: End-of-file POD example:

                package My::Class;
                use strict;
                @My::Class::ISA     = ();
                $My::Class::VERSION = '1.1';
                sub new {
                        my ( $pkg, $params ) = @_;
                        my $class = ref $pkg || $pkg;
                        return bless( $params, $class );
                }
                sub fetch_paper {
                        my ( $self ) = @_;
                        ...
                }
                1;
                __END__
                =pod
                =head1 NAME
                My::Class -- Does whatever I tell it
                =head1 SYNOPSIS
                 my $my    = My::Class->new();
                 my $paper = eval { $my->fetch_paper() };
                 if ( $@ ) {
                         die "Sorry, could not fetch paper because of: $@";
                 }
                =head1 DESCRIPTION
                This class defines a multipurpose, serializable and network
                transportable object.
                =head1 METHODS
                B<new( \%params )> (constructor)
                Create a new instance of this class. Initialize the object with
                whatever is in C<\%params>, which are not predefined.</p>
                Returns: new instance of this class.
                B<fetch_paper()>
                Retrieves paper from environment and returns it. Should be wrapped
                in an C<eval{}> to catch errors.
                Returns: L<My::Paper> object.
                =head1 TO DO
                Other operations should be added: fetch_slippers, eat_homework.
                =head1 BUGS
                Ensure that no C<My::Flea> objects are associated with object.
                =head1 COPYRIGHT
                Same as Perl.
                =head1 AUTHORS
                J. Appleseed <johnny@appleseed.com>
                =cut    

<< Previous | Index | Next >> Copyright © 2004 Daniel Allen