The road to better programming: Chapter 5 Modules and objects
h2xs: your new best friend
Don't you wish there was a tool that could write your Perl class for
you, that could write a documentation (POD) skeleton as well, and
generally make your life easier by doing things right? Perl comes with
exactly that sort of tool: h2xs
.
The important flags to remember are "-A -n Module
". With those, h2xs will generate a skeleton directory called "Module" full of useful files. They are:
-
Module.pm
, the module itself, with skeleton documentation already written. -
Module.xs
, for linking your module to C code. (Run "perldoc perlxs
" for more information.) -
MANIFEST
, a list of files for packaging. -
test.pl
, a skeleton testing script. -
Changes
, a log of changes made to the module. -
Makefile.PL
, a makefile generator (run it with "perl Makefile.PL
".)
You don't need to use all these files, but it's nice to know they are there when you do need them.
View The road to better programming: Chapter 5 Modules and objects Discussion
Page: 1 2 3 4 5 6 7 8 Next Page: Exercises and ResourcesFirst published by IBM developerWorks