Chapter 4
a dash. Everything after the dash is the module's abstract.
11
For example, here's the
section from Data::Counter's module file where the abstract would be extracted:
Data::Counter Perl extension to count data items.
Finally, the AUTHOR parameter gives the name and e mail address for the author of
the module.
The Makefile.PL for Data::Counter is in Listing 4 4. This is a simple Makefile.PL;
for more information about Makefile.PL techniques, see the Exploring the
Distribution section later in this chapter.
Listing 4 4. Modified Makefile.PL for Data::Counter
use ExtUtils::MakeMaker;
use 5.006; # this module requires Perl 5.6.0
WriteMakefile(
NAME => "Data::Counter",
VERSION_FROM => "Counter.pm",
ABSTRACT_FROM => "Counter.pm",
AUTHOR => Sam Tregar
);
test.pl The Test Script
h2xs generates a simple test script that you can use to build regression tests for your
module. A regression test is a test that proves a described feature performs the way
it is supposed to work. By developing regression tests for your module, you'll be
sure that your module works the way your documentation says it does. Also, when
you fix a bug, you can add a regression test to prove that it's fixed after which you
can be sure that the bug will never be reintroduced into your module. Similarly,
when you add a new feature, you can add a new test so that you can be sure the
feature works as advertised.
The generated test script (see Listing 4 5) is a normal Perl script that uses a
module called Test.
12
The Test module exports a subroutine called plan(), which
must be called before any tests. In this case, plan() is called inside a BEGIN block
with a single named parameter, tests, giving the number of tests to be run. When
you add a test to the script, you'll need to update this number.
11. For the regex literate: /^$package\s \s(.*)/
12. Written by Joshua Nathaniel Pritikin
108
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved