1.5 Defining Modules
To
begin, take a file of subroutine definitions and call it something
like Newmodule.pm. Now, edit the file and give it
a new first line: package Newmodule;
and a new last line 1;. You've
now created a Perl module. To make a Celegans module, place subroutines in a
file called Celegans.pm, and add a first line: package Celegans;
Add a last line 1;, and you've
defined a Celegans module. This last line just
ensures that the library returns a true value when
it's read in. It's annoying, but
necessary. |