a2p
accept
access
acct
addftinfo
addr2line
adjtime
afmtodit
after
aio_cancel
aio_error
aio_read
aio_return
aio_suspend
aio_waitcomplete
aio_write
alias
aliases
alloc
anvil
append
apply
apropos
ar
array
as
asa
asn1parse
at
atq
atrm
attemptckalloc
attemptckrealloc
authlib
authtest
autopoint
awk
b64decode
b64encode
basename
batch
bc
bdes
bell
bg
bgerror
biff
big5
binary
bind
bindkey
bindtags
bindtextdomain
bio
bitmap
blowfish
bn
bootparams
bootptab
bounce
brandelf
break
breaksw
brk
bsdiff
bsdtar
bsnmpd
bspatch
bthost
btsockstat
buffer
builtin
builtins
bunzip2
button
byacc
bzcat
bzegrep
bzfgrep
bzgrep
bzip2
c2ph
c89
c99
ca
cal
calendar
canvas
cap_mkdb
case
cat
catch
catman
cc
cd
cdcontrol
chdir
checkbutton
checknr
chflags
chfn
chgrp
chio
chkey
chmod
chown
chpass
chroot
chsh
ci
ciphers
ckalloc
ckdist
ckfree
ckrealloc
cksum
cleanup
clear
clipboard
clock
clock_getres
clock_gettime
clock_settime
close
cmp
co
col
colcrt
colldef
colors
colrm
column
comm
command
compile_et
complete
compress
concat
config
connect
console
continue
core
courierlogger
couriertcpd
cp
cpan
cpio
cpp
creat
crl
crontab
crunchgen
crunchide
crypt
crypto
csh
csplit
ctags
ctm
ctm_dequeue
ctm_rmail
ctm_smail
cu
cursor
cursors
cut
cvs
date
dbiprof
dbiproxy
dc
dcgettext
dcngettext
dd
dde
default
defer
deliverquota
des
destroy
devfs
df
dgettext
dgst
dh
dhparam
dialog
diff
diff3
dig
dir
dirent
dirname
dirs
discard
disktab
dngettext
do
domainname
done
dprofpp
dsa
dsaparam
dtmfdecode
du
dup
dup2
eaccess
ec
ecdsa
echo
echotc
ecparam
ed
edit
editrc
ee
egrep
elf
elfdump
elif
else
enc
enc2xs
encoding
end
endif
endsw
engine
enigma
entry
env
envsubst
eof
eqn
err
errno
error
errstr
esac
ethers
euc
eui64
eval
event
evp
ex
exec
execve
exit
expand
export
exports
expr
extattr
extattr_delete_fd
extattr_delete_file
extattr_get_fd
extattr_get_file
extattr_set_fd
extattr_set_file
f77
false
famm
famx
fblocked
fbtab
fc
fchdir
fchflags
fchmod
fchown
fcntl
fconfigure
fcopy
fdescfs
fdformat
fdread
fdwrite
fetch
fg
fgrep
fhopen
fhstat
fhstatfs
fi
file
file2c
fileevent
filename
filetest
find
find2perl
finger
flex
flock
flush
fmt
focus
fold
font
fontedit
for
foreach
fork
format
forward
fpathconf
frame
from
fs
fstab
fstat
fstatfs
fsync
ftp
ftpchroot
ftpusers
ftruncate
futimes
g711conv
gb2312
gb18030
gbk
gcc
gcore
gcov
gdb
gencat
gendsa
genrsa
gensnmptree
getconf
getdents
getdirentries
getdtablesize
getegid
geteuid
getfacl
getfh
getfsstat
getgid
getgroups
getitimer
getlogin
getopt
getopts
getpeername
getpgid
getpgrp
getpid
getppid
getpriority
getresgid
getresuid
getrlimit
getrusage
gets
getsid
getsockname
getsockopt
gettext
gettextize
gettimeofday
gettytab
getuid
glob
global
gmake
goto
gperf
gprof
grab
grep
grid
grn
grodvi
groff
groff_font
groff_out
groff_tmac
grog
grolbp
grolj4
grops
grotty
group
groups
gunzip
gzcat
gzexe
gzip
h2ph
h2xs
hash
hashstat
hd
head
help2man
hesinfo
hexdump
history
host
hostname
hosts
hosts_access
hosts_options
hpftodit
http
hup
i386_get_ioperm
i386_get_ldt
i386_set_ioperm
i386_set_ldt
i386_vm86
iconv
id
ident
idprio
if
ifnames253
ifnames259
image
imapd
incr
indent
indxbib
info
infokey
inode
install
instmodsh
interp
intro
introduction
ioctl
ipcrm
ipcs
ipf
ipftest
ipnat
ippool
ipresend
issetugid
jail
jail_attach
jobid
jobs
join
jot
kbdcontrol
kbdmap
kcon
kdestroy
kdump
kenv
kevent
keycap
keylogin
keylogout
keymap
keysyms
kgdb
kill
killall
killpg
kinit
kldfind
kldfirstmod
kldload
kldnext
kldstat
kldsym
kldunload
klist
kpasswd
kqueue
kse
kse_create
kse_exit
kse_release
kse_switchin
kse_thr_interrupt
kse_wakeup
ktrace
label
labelframe
lam
lappend
last
lastcomm
lastlog
lchflags
lchmod
lchown
ld
ldap
ldapadd
ldapcompare
ldapdelete
ldapmodify
ldapmodrdn
ldappasswd
ldapsearch
ldapwhoami
ldd
leave
less
lesskey
lex
lgetfh
lhash
libnetcfg
library
limit
limits
lindex
link
linprocfs
linsert
lint
lio_listio
list
listbox
listen
lj4_font
lkbib
llength
lmtp
ln
load
loadfont
local
locale
locate
lock
lockf
log
logger
login
logins
logname
logout
look
lookbib
lorder
lower
lp
lpq
lpr
lprm
lptest
lrange
lreplace
ls
lsearch
lseek
lset
lsort
lstat
lsvfs
lutimes
lynx
m4
madvise
magic
mail
maildiracl
maildirkw
maildirmake
mailq
mailx
make
makeinfo
makewhatis
man
manpath
master
mc
mcedit
mcview
md2
md4
md5
mdc2
memory
menu
menubar
menubutton
merge
mesg
message
mincore
minherit
minigzip
mkdep
mkdir
mkfifo
mkimapdcert
mklocale
mknod
mkpop3dcert
mkstr
mktemp
mlock
mlockall
mmap
mmroff
modfind
modfnext
modnext
modstat
moduli
more
motd
mount
mprotect
mptable
msdos
msdosfs
msgattrib
msgcat
msgcmp
msgcomm
msgconv
msgen
msgexec
msgfilter
msgfmt
msggrep
msginit
msgmerge
msgs
msgunfmt
msguniq
mskanji
msql2mysql
msync
mt
munlock
munlockall
munmap
mv
myisamchk
myisamlog
myisampack
mysql
mysqlaccess
mysqladmin
mysqlbinlog
mysqlcheck
mysqld
mysqldump
mysqld_multi
mysqld_safe
mysqlhotcopy
mysqlimport
mysqlshow
mysql_config
mysql_fix_privilege_tables
mysql_zap
namespace
nanosleep
nawk
nc
ncal
ncplist
ncplogin
ncplogout
neqn
netconfig
netgroup
netid
netstat
networks
newaliases
newgrp
nex
nfsstat
nfssvc
ngettext
nice
nl
nm
nmount
nohup
nologin
notify
nroff
nseq
nslookup
ntp_adjtime
ntp_gettime
nvi
nview
objcopy
objdump
objformat
ocsp
od
onintr
open
openssl
opieaccess
opieinfo
opiekey
opiekeys
opiepasswd
option
options
oqmgr
pack
package
packagens
pagesize
palette
pam_auth
panedwindow
parray
passwd
paste
patch
pathchk
pathconf
pawd
pax
pbm
pcre
pcreapi
pcrebuild
pcrecallout
pcrecompat
pcrecpp
pcregrep
pcrematching
pcrepartial
pcrepattern
pcreperform
pcreposix
pcreprecompile
pcresample
pcretest
perl
perl56delta
perl58delta
perl561delta
perl570delta
perl571delta
perl572delta
perl573delta
perl581delta
perl582delta
perl583delta
perl584delta
perl585delta
perl586delta
perl587delta
perl588delta
perl5004delta
perl5005delta
perlaix
perlamiga
perlapi
perlapio
perlapollo
perlartistic
perlbeos
perlbook
perlboot
perlbot
perlbs2000
perlbug
perlcall
perlcc
perlce
perlcheat
perlclib
perlcn
perlcompile
perlcygwin
perldata
perldbmfilter
perldebguts
perldebtut
perldebug
perldelta
perldgux
perldiag
perldoc
perldos
perldsc
perlebcdic
perlembed
perlepoc
perlfaq
perlfaq1
perlfaq2
perlfaq3
perlfaq4
perlfaq5
perlfaq6
perlfaq7
perlfaq8
perlfaq9
perlfilter
perlfork
perlform
perlfreebsd
perlfunc
perlglossary
perlgpl
perlguts
perlhack
perlhist
perlhpux
perlhurd
perlintern
perlintro
perliol
perlipc
perlirix
perlivp
perljp
perlko
perllexwarn
perllinux
perllocale
perllol
perlmachten
perlmacos
perlmacosx
perlmint
perlmod
perlmodinstall
perlmodlib
perlmodstyle
perlmpeix
perlnetware
perlnewmod
perlnumber
perlobj
perlop
perlopenbsd
perlopentut
perlos2
perlos390
perlos400
perlothrtut
perlpacktut
perlplan9
perlpod
perlpodspec
perlport
perlqnx
perlre
perlref
perlreftut
perlrequick
perlreref
perlretut
perlrun
perlsec
perlsolaris
perlstyle
perlsub
perlsyn
perlthrtut
perltie
perltoc
perltodo
perltooc
perltoot
perltrap
perltru64
perltw
perlunicode
perluniintro
perlutil
perluts
perlvar
perlvmesa
perlvms
perlvos
perlwin32
perlxs
perlxstut
perror
pfbtops
pftp
pgrep
phones
photo
pic
pickup
piconv
pid
pipe
pkcs7
pkcs8
pkcs12
pkg_add
pkg_check
pkg_create
pkg_delete
pkg_info
pkg_sign
pkg_version
pkill
pl2pm
place
pod2html
pod2latex
pod2man
pod2text
pod2usage
podchecker
podselect
poll
popd
popup
posix_madvise
postalias
postcat
postconf
postdrop
postfix
postkick
postlock
postlog
postmap
postqueue
postsuper
pr
pread
preadv
printcap
printenv
printf
proc
procfs
profil
protocols
prove
proxymap
ps
psed
psroff
pstruct
ptrace
publickey
pushd
puts
pwd
pwrite
pwritev
qmgr
qmqpd
quota
quotactl
radiobutton
raise
rand
ranlib
rcp
rcs
rcsclean
rcsdiff
rcsfile
rcsfreeze
rcsintro
rcsmerge
read
readelf
readlink
readonly
readv
realpath
reboot
recv
recvfrom
recvmsg
red
ree
refer
regexp
registry
regsub
rehash
remote
rename
repeat
replace
req
reset
resolver
resource
return
rev
revoke
rfcomm_sppd
rfork
rhosts
ripemd
ripemd160
rlog
rlogin
rm
rmd160
rmdir
rpc
rpcgen
rs
rsa
rsautl
rsh
rtld
rtprio
rup
ruptime
rusers
rwall
rwho
s2p
safe
sasl
sasldblistusers2
saslpasswd2
sbrk
scache
scale
scan
sched
sched_getparam
sched_getscheduler
sched_get_priority_max
sched_get_priority_min
sched_rr_get_interval
sched_setparam
sched_setscheduler
sched_yield
scon
scp
script
scrollbar
sdiff
sed
seek
select
selection
semctl
semget
semop
send
sendbug
sendfile
sendmail
sendmsg
sendto
services
sess_id
set
setegid
setenv
seteuid
setfacl
setgid
setgroups
setitimer
setlogin
setpgid
setpgrp
setpriority
setregid
setresgid
setresuid
setreuid
setrlimit
setsid
setsockopt
settc
settimeofday
setty
setuid
setvar
sftp
sh
sha
sha1
sha256
shar
shells
shift
shmat
shmctl
shmdt
shmget
showq
shutdown
sigaction
sigaltstack
sigblock
sigmask
sigpause
sigpending
sigprocmask
sigreturn
sigsetmask
sigstack
sigsuspend
sigvec
sigwait
size
slapadd
slapcat
slapd
slapdn
slapindex
slappasswd
slaptest
sleep
slogin
slurpd
smbutil
smime
smtp
smtpd
socket
socketpair
sockstat
soelim
sort
source
spawn
speed
spinbox
spkac
splain
split
squid
squid_ldap_auth
squid_ldap_group
squid_unix_group
sscop
ssh
sshd_config
ssh_config
stab
startslip
stat
statfs
stop
string
strings
strip
stty
su
subst
sum
suspend
swapoff
swapon
switch
symlink
sync
sysarch
syscall
sysconftool
sysconftoolcheck
systat
s_client
s_server
s_time
tabs
tail
talk
tar
tbl
tclsh
tcltest
tclvars
tcopy
tcpdump
tcpslice
tcsh
tee
tell
telltc
telnet
term
termcap
terminfo
test
texindex
texinfo
text
textdomain
tfmtodit
tftp
then
threads
time
tip
tk
tkerror
tkvars
tkwait
tlsmgr
tmac
top
toplevel
touch
tput
tr
trace
trafshow
trap
troff
true
truncate
truss
tset
tsort
tty
ttys
type
tzfile
ui
ul
ulimit
umask
unalias
uname
uncomplete
uncompress
undelete
unexpand
unhash
unifdef
unifdefall
uniq
units
unknown
unlimit
unlink
unmount
unset
unsetenv
until
unvis
update
uplevel
uptime
upvar
usbhidaction
usbhidctl
users
utf8
utimes
utmp
utrace
uudecode
uuencode
uuidgen
vacation
variable
verify
version
vfork
vgrind
vgrindefs
vi
vidcontrol
vidfont
view
virtual
vis
vt220keys
vwait
w
wait
wait3
wait4
waitpid
wall
wc
wget
what
whatis
where
whereis
which
while
who
whoami
whois
window
winfo
wish
wm
write
writev
wtmp
x509
xargs
xgettext
xmlwf
xstr
xsubpp
yacc
yes
ypcat
ypchfn
ypchpass
ypchsh
ypmatch
yppasswd
ypwhich
yyfix
zcat
zcmp
zdiff
zegrep
zfgrep
zforce
zgrep
zmore
znew
_exit
__syscall
 
FreeBSD/Linux/UNIX General Commands Manual
Hypertext Man Pages
perlmodstyle
 
PERLMODSTYLE(1)        Perl Programmers Reference Guide        PERLMODSTYLE(1)



NAME
       perlmodstyle - Perl module style guide

INTRODUCTION
       This document attempts to describe the Perl Community's "best practice"
       for writing Perl modules.  It extends the recommendations found in
       perlstyle , which should be considered required reading before reading
       this document.

       While this document is intended to be useful to all module authors, it
       is particularly aimed at authors who wish to publish their modules on
       CPAN.

       The focus is on elements of style which are visible to the users of a
       module, rather than those parts which are only seen by the module's
       developers.  However, many of the guidelines presented in this document
       can be extrapolated and applied successfully to a module's internals.

       This document differs from perlnewmod in that it is a style guide
       rather than a tutorial on creating CPAN modules.  It provides a check-
       list against which modules can be compared to determine whether they
       conform to best practice, without necessarily describing in detail how
       to achieve this.

       All the advice contained in this document has been gleaned from exten-
       sive conversations with experienced CPAN authors and users.  Every
       piece of advice given here is the result of previous mistakes.  This
       information is here to help you avoid the same mistakes and the extra
       work that would inevitably be required to fix them.

       The first section of this document provides an itemized checklist; sub-
       sequent sections provide a more detailed discussion of the items on the
       list.  The final section, "Common Pitfalls", describes some of the most
       popular mistakes made by CPAN authors.

QUICK CHECKLIST
       For more detail on each item in this checklist, see below.

       Before you start


       o   Don't re-invent the wheel

       o   Patch, extend or subclass an existing module where possible

       o   Do one thing and do it well

       o   Choose an appropriate name

       The API


       o   API should be understandable by the average programmer

       o   Simple methods for simple tasks

       o   Separate functionality from output

       o   Consistent naming of subroutines or methods

       o   Use named parameters (a hash or hashref) when there are more than
	   two parameters

       Stability


       o   Ensure your module works under "use strict" and "-w"

       o   Stable modules should maintain backwards compatibility

       Documentation


       o   Write documentation in POD

       o   Document purpose, scope and target applications

       o   Document each publically accessible method or subroutine, including
	   params and return values

       o   Give examples of use in your documentation

       o   Provide a README file and perhaps also release notes, changelog,
	   etc

       o   Provide links to further information (URL, email)

       Release considerations


       o   Specify pre-requisites in Makefile.PL or Build.PL

       o   Specify Perl version requirements with "use"

       o   Include tests with your module

       o   Choose a sensible and consistent version numbering scheme (X.YY is
	   the common Perl module numbering scheme)

       o   Increment the version number for every change, no matter how small

       o   Package the module using "make dist"

       o   Choose an appropriate license (GPL/Artistic is a good default)

BEFORE YOU START WRITING A MODULE
       Try not to launch headlong into developing your module without spending
       some time thinking first.  A little forethought may save you a vast
       amount of effort later on.

       Has it been done before?

       You may not even need to write the module.  Check whether it's already
       been done in Perl, and avoid re-inventing the wheel unless you have a
       good reason.

       Good places to look for pre-existing modules include
       http://search.cpan.org/ and asking on modules@perl.org

       If an existing module almost does what you want, consider writing a
       patch, writing a subclass, or otherwise extending the existing module
       rather than rewriting it.

       Do one thing and do it well

       At the risk of stating the obvious, modules are intended to be modular.
       A Perl developer should be able to use modules to put together the
       building blocks of their application.  However, it's important that the
       blocks are the right shape, and that the developer shouldn't have to
       use a big block when all they need is a small one.

       Your module should have a clearly defined scope which is no longer than
       a single sentence.  Can your module be broken down into a family of
       related modules?

       Bad example:

       "FooBar.pm provides an implementation of the FOO protocol and the
       related BAR standard."

       Good example:

       "Foo.pm provides an implementation of the FOO protocol.	Bar.pm imple-
       ments the related BAR protocol."

       This means that if a developer only needs a module for the BAR stan-
       dard, they should not be forced to install libraries for FOO as well.

       What's in a name?

       Make sure you choose an appropriate name for your module early on.
       This will help people find and remember your module, and make program-
       ming with your module more intuitive.

       When naming your module, consider the following:

       o   Be descriptive (i.e. accurately describes the purpose of the mod-
	   ule).

       o   Be consistent with existing modules.

       o   Reflect the functionality of the module, not the implementation.

       o   Avoid starting a new top-level hierarchy, especially if a suitable
	   hierarchy already exists under which you could place your module.

       You should contact modules@perl.org to ask them about your module name
       before publishing your module.  You should also try to ask people who
       are already familiar with the module's application domain and the CPAN
       naming system.  Authors of similar modules, or modules with similar
       names, may be a good place to start.

DESIGNING AND WRITING YOUR MODULE
       Considerations for module design and coding:

       To OO or not to OO?

       Your module may be object oriented (OO) or not, or it may have both
       kinds of interfaces available.  There are pros and cons of each tech-
       nique, which should be considered when you design your API.

       According to Damian Conway, you should consider using OO:

       o   When the system is large or likely to become so

       o   When the data is aggregated in obvious structures that will become
	   objects

       o   When the types of data form a natural hierarchy that can make use
	   of inheritance

       o   When operations on data vary according to data type (making poly-
	   morphic invocation of methods feasible)

       o   When it is likely that new data types may be later introduced into
	   the system, and will need to be handled by existing code

       o   When interactions between data are best represented by overloaded
	   operators

       o   When the implementation of system components is likely to change
	   over time (and hence should be encapsulated)

       o   When the system design is itself object-oriented

       o   When large amounts of client code will use the software (and should
	   be insulated from changes in its implementation)

       o   When many separate operations will need to be applied to the same
	   set of data

       Think carefully about whether OO is appropriate for your module.  Gra-
       tuitous object orientation results in complex APIs which are difficult
       for the average module user to understand or use.

       Designing your API

       Your interfaces should be understandable by an average Perl programmer.
       The following guidelines may help you judge whether your API is suffi-
       ciently straightforward:

       Write simple routines to do simple things.
	   It's better to have numerous simple routines than a few monolithic
	   ones.  If your routine changes its behaviour significantly based on
	   its arguments, it's a sign that you should have two (or more) sepa-
	   rate routines.

       Separate functionality from output.
	   Return your results in the most generic form possible and allow the
	   user to choose how to use them.  The most generic form possible is
	   usually a Perl data structure which can then be used to generate a
	   text report, HTML, XML, a database query, or whatever else your
	   users require.

	   If your routine iterates through some kind of list (such as a list
	   of files, or records in a database) you may consider providing a
	   callback so that users can manipulate each element of the list in
	   turn.  File::Find provides an example of this with its
	   "find(\&wanted, $dir)" syntax.

       Provide sensible shortcuts and defaults.
	   Don't require every module user to jump through the same hoops to
	   achieve a simple result.  You can always include optional parame-
	   ters or routines for more complex or non-standard behaviour.  If
	   most of your users have to type a few almost identical lines of
	   code when they start using your module, it's a sign that you should
	   have made that behaviour a default.	Another good indicator that
	   you should use defaults is if most of your users call your routines
	   with the same arguments.

       Naming conventions
	   Your naming should be consistent.  For instance, it's better to
	   have:

		   display_day();
		   display_week();
		   display_year();

	   than

		   display_day();
		   week_display();
		   show_year();

	   This applies equally to method names, parameter names, and anything
	   else which is visible to the user (and most things that aren't!)

       Parameter passing
	   Use named parameters. It's easier to use a hash like this:

	       $obj->do_something(
		       name => "wibble",
		       type => "text",
		       size => 1024,
	       );

	   ... than to have a long list of unnamed parameters like this:

	       $obj->do_something("wibble", "text", 1024);

	   While the list of arguments might work fine for one, two or even
	   three arguments, any more arguments become hard for the module user
	   to remember, and hard for the module author to manage.  If you want
	   to add a new parameter you will have to add it to the end of the
	   list for backward compatibility, and this will probably make your
	   list order unintuitive.  Also, if many elements may be undefined
	   you may see the following unattractive method calls:

	       $obj->do_something(undef, undef, undef, undef, undef, undef, 1024);

	   Provide sensible defaults for parameters which have them.  Don't
	   make your users specify parameters which will almost always be the
	   same.

	   The issue of whether to pass the arguments in a hash or a hashref
	   is largely a matter of personal style.

	   The use of hash keys starting with a hyphen ("-name") or entirely
	   in upper case ("NAME") is a relic of older versions of Perl in
	   which ordinary lower case strings were not handled correctly by the
	   "=>" operator.  While some modules retain uppercase or hyphenated
	   argument keys for historical reasons or as a matter of personal
	   style, most new modules should use simple lower case keys.  What-
	   ever you choose, be consistent!

       Strictness and warnings

       Your module should run successfully under the strict pragma and should
       run without generating any warnings.  Your module should also handle
       taint-checking where appropriate, though this can cause difficulties in
       many cases.

       Backwards compatibility

       Modules which are "stable" should not break backwards compatibility
       without at least a long transition phase and a major change in version
       number.

       Error handling and messages

       When your module encounters an error it should do one or more of:

       o   Return an undefined value.

       o   set $Module::errstr or similar ("errstr" is a common name used by
	   DBI and other popular modules; if you choose something else, be
	   sure to document it clearly).

       o   "warn()" or "carp()" a message to STDERR.

       o   "croak()" only when your module absolutely cannot figure out what
	   to do.  ("croak()" is a better version of "die()" for use within
	   modules, which reports its errors from the perspective of the
	   caller.  See Carp for details of "croak()", "carp()" and other use-
	   ful routines.)

       o   As an alternative to the above, you may prefer to throw exceptions
	   using the Error module.

       Configurable error handling can be very useful to your users.  Consider
       offering a choice of levels for warning and debug messages, an option
       to send messages to a separate file, a way to specify an error-handling
       routine, or other such features.  Be sure to default all these options
       to the commonest use.

DOCUMENTING YOUR MODULE
       POD

       Your module should include documentation aimed at Perl developers.  You
       should use Perl's "plain old documentation" (POD) for your general
       technical documentation, though you may wish to write additional docu-
       mentation (white papers, tutorials, etc) in some other format.  You
       need to cover the following subjects:

       o   A synopsis of the common uses of the module

       o   The purpose, scope and target applications of your module

       o   Use of each publically accessible method or subroutine, including
	   parameters and return values

       o   Examples of use

       o   Sources of further information

       o   A contact email address for the author/maintainer

       The level of detail in Perl module documentation generally goes from
       less detailed to more detailed.	Your SYNOPSIS section should contain a
       minimal example of use (perhaps as little as one line of code; skip the
       unusual use cases or anything not needed by most users); the DESCRIP-
       TION should describe your module in broad terms, generally in just a
       few paragraphs; more detail of the module's routines or methods,
       lengthy code examples, or other in-depth material should be given in
       subsequent sections.

       Ideally, someone who's slightly familiar with your module should be
       able to refresh their memory without hitting "page down".  As your
       reader continues through the document, they should receive a progres-
       sively greater amount of knowledge.

       The recommended order of sections in Perl module documentation is:

       o   NAME

       o   SYNOPSIS

       o   DESCRIPTION

       o   One or more sections or subsections giving greater detail of avail-
	   able methods and routines and any other relevant information.

       o   BUGS/CAVEATS/etc

       o   AUTHOR

       o   SEE ALSO

       o   COPYRIGHT and LICENSE

       Keep your documentation near the code it documents ("inline" documenta-
       tion).  Include POD for a given method right above that method's sub-
       routine.  This makes it easier to keep the documentation up to date,
       and avoids having to document each piece of code twice (once in POD and
       once in comments).

       README, INSTALL, release notes, changelogs

       Your module should also include a README file describing the module and
       giving pointers to further information (website, author email).

       An INSTALL file should be included, and should contain simple installa-
       tion instructions. When using ExtUtils::MakeMaker this will usually be:

       perl Makefile.PL
       make
       make test
       make install

       When using Module::Build, this will usually be:

       perl Build.PL
       perl Build
       perl Build test
       perl Build install

       Release notes or changelogs should be produced for each release of your
       software describing user-visible changes to your module, in terms rele-
       vant to the user.

RELEASE CONSIDERATIONS
       Version numbering

       Version numbers should indicate at least major and minor releases, and
       possibly sub-minor releases.  A major release is one in which most of
       the functionality has changed, or in which major new functionality is
       added.  A minor release is one in which a small amount of functionality
       has been added or changed.  Sub-minor version numbers are usually used
       for changes which do not affect functionality, such as documentation
       patches.

       The most common CPAN version numbering scheme looks like this:

	   1.00, 1.10, 1.11, 1.20, 1.30, 1.31, 1.32

       A correct CPAN version number is a floating point number with at least
       2 digits after the decimal. You can test whether it conforms to CPAN by
       using

	   perl -MExtUtils::MakeMaker -le 'print MM->parse_version(shift)' 'Foo.pm'

       If you want to release a 'beta' or 'alpha' version of a module but
       don't want CPAN.pm to list it as most recent use an '_' after the regu-
       lar version number followed by at least 2 digits, eg. 1.20_01. If you
       do this, the following idiom is recommended:

	 $VERSION = "1.12_01";
	 $XS_VERSION = $VERSION; # only needed if you have XS code
	 $VERSION = eval $VERSION;

       With that trick MakeMaker will only read the first line and thus read
       the underscore, while the perl interpreter will evaluate the $VERSION
       and convert the string into a number. Later operations that treat $VER-
       SION as a number will then be able to do so without provoking a warning
       about $VERSION not being a number.

       Never release anything (even a one-word documentation patch) without
       incrementing the number.  Even a one-word documentation patch should
       result in a change in version at the sub-minor level.

       Pre-requisites

       Module authors should carefully consider whether to rely on other mod-
       ules, and which modules to rely on.

       Most importantly, choose modules which are as stable as possible.  In
       order of preference:

       o   Core Perl modules

       o   Stable CPAN modules

       o   Unstable CPAN modules

       o   Modules not available from CPAN

       Specify version requirements for other Perl modules in the pre-requi-
       sites in your Makefile.PL or Build.PL.

       Be sure to specify Perl version requirements both in Makefile.PL or
       Build.PL and with "require 5.6.1" or similar. See the section on "use
       VERSION" of "require" in perlfunc for details.

       Testing

       All modules should be tested before distribution (using "make
       disttest"), and the tests should also be available to people installing
       the modules (using "make test").  For Module::Build you would use the
       "make test" equivalent "perl Build test".

       The importance of these tests is proportional to the alleged stability
       of a module -- a module which purports to be stable or which hopes to
       achieve wide use should adhere to as strict a testing regime as possi-
       ble.

       Useful modules to help you write tests (with minimum impact on your
       development process or your time) include Test::Simple, Carp::Assert
       and Test::Inline.  For more sophisticated test suites there are
       Test::More and Test::MockObject.

       Packaging

       Modules should be packaged using one of the standard packaging tools.
       Currently you have the choice between ExtUtils::MakeMaker and the more
       platform independent Module::Build, allowing modules to be installed in
       a consistent manner.  When using ExtUtils::MakeMaker, you can use "make
       dist" to create your package. Tools exist to help you to build your
       module in a MakeMaker-friendly style. These include ExtUtils::Module-
       Maker and h2xs.	See also perlnewmod.

       Licensing

       Make sure that your module has a license, and that the full text of it
       is included in the distribution (unless it's a common one and the terms
       of the license don't require you to include it).

       If you don't know what license to use, dual licensing under the GPL and
       Artistic licenses (the same as Perl itself) is a good idea.  See perl-
       gpl and perlartistic.

COMMON PITFALLS
       Reinventing the wheel

       There are certain application spaces which are already very, very well
       served by CPAN.	One example is templating systems, another is date and
       time modules, and there are many more.  While it is a rite of passage
       to write your own version of these things, please consider carefully
       whether the Perl world really needs you to publish it.

       Trying to do too much

       Your module will be part of a developer's toolkit.  It will not, in
       itself, form the entire toolkit.  It's tempting to add extra features
       until your code is a monolithic system rather than a set of modular
       building blocks.

       Inappropriate documentation

       Don't fall into the trap of writing for the wrong audience.  Your pri-
       mary audience is a reasonably experienced developer with at least a
       moderate understanding of your module's application domain, who's just
       downloaded your module and wants to start using it as quickly as possi-
       ble.

       Tutorials, end-user documentation, research papers, FAQs etc are not
       appropriate in a module's main documentation.  If you really want to
       write these, include them as sub-documents such as "My::Module::Tuto-
       rial" or "My::Module::FAQ" and provide a link in the SEE ALSO section
       of the main documentation.

SEE ALSO
       perlstyle
	   General Perl style guide

       perlnewmod
	   How to create a new module

       perlpod
	   POD documentation

       podchecker
	   Verifies your POD's correctness

       Packaging Tools
	   ExtUtils::MakeMaker, Module::Build

       Testing tools
	   Test::Simple, Test::Inline, Carp::Assert, Test::More, Test::MockOb-
	   ject

       http://pause.perl.org/
	   Perl Authors Upload Server.	Contains links to information for mod-
	   ule authors.

       Any good book on software engineering

AUTHOR
       Kirrily "Skud" Robert 



perl v5.8.8			  2006-01-07		       PERLMODSTYLE(1)
=193381
+48
(44)