Name Last modified Size Description
Parent Directory - readme.html 11-Oct-2012 23:57 2.0K README.html 11-Oct-2012 23:57 2.0K module-tutorial.tar.gz 29-Jul-2002 02:39 4.6K Class/ 26-Jan-2002 22:15 - module-tutorial.zip 23-Mar-2001 18:26 4.7K README.txt 23-Mar-2001 18:26 1.9K README 23-Mar-2001 18:26 1.9K Inherit/ 23-Mar-2001 18:26 - Module/ 13-Oct-2000 16:51 - Makefile 13-Sep-1999 06:36 593
There are two styles you can use for Perl modules. Both are useful under different circumstances.
In the `exporting' style, the `module file' defines some functions which you can load into your program and use as if you had defined them yourself.
In the `object oriented' style, your module defines a `class' that knows how to construct `objects' that perform actions on behalf of the program when their methods are invoked.
You should visit the Module directory first. It has an extremely simple module, an example program that uses it, and a list of exercises. You should do all the exercises. When you are done you will know how to write a module in the `module' style. The examples are complete, but they are so simple that they will both fit on the screen at the same time. Together they are eighteen lines long.
Then you should move to the Class directory, which has an extremely simple object-oriented module, a sample program, and a list of exercises. Do the exercsises. When you're done you will know how to write a module in the `object oriented' style. The example is a complete object-oriented program that creates an object and calls a method on it. It is a little longer than the other example. It is thirty-nine lines long. Fourteen of the lines are blank.
There is also a third part, in the Inherit directory. It shows how Perl does method inheritance in object-oriented classes. You should do the exercises there last.
The module-tutorial.tar.gz and module-tutorial.zip files contain everything from all three directories.
Best of luck.
Author: M-J. Dominus
With useful suggestions and improvements from: