Index of /Hello

[ICO]NameLast modifiedSizeDescription

[PARENTDIR]Parent Directory  -  
[TXT]readme.html2012-10-11 23:57 2.0K 
[TXT]README.html2012-10-11 23:57 2.0K 
[   ]module-tutorial.tar.gz2002-07-29 02:39 4.6K 
[DIR]Class/2002-01-26 22:15 -  
[   ]module-tutorial.zip2001-03-23 18:26 4.7K 
[TXT]README.txt2001-03-23 18:26 1.9K 
[TXT]README2001-03-23 18:26 1.9K 
[DIR]Inherit/2001-03-23 18:26 -  
[DIR]Module/2000-10-13 16:51 -  
[   ]Makefile1999-09-13 06:36 593  

The very very short tutorial about modules in Perl

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.

Credits

Author: M-J. Dominus

With useful suggestions and improvements from: