|
Softpanorama |
May the source be with you, but remember the KISS principle ;-)
Softpanorama Search
|
|
Books |
Recommended Links | Recommended Articles | CPAN | Perl namespaces |
|
||
| Getopt::Std | Getopt::Long | Net::ftp | Net::netrc | Benchmark | Net::Telnet | File::Find | |
| Expect.pm | Reimplementation of Unix tools | Pipes in Perl | Debugging | Tips | Beautifiers | Humor | Etc |
Perl module is a package within a file which uses its own namespace. It's a collection of subroutines and variables, Some subroutines can be "exposed" - visible in the namespace into which you incorporate the module. Technically, it is a particular set of conventions for using Perl's package mechanism that has become universally adopted. for example exporting subroutines into the namespace of the invoking script via @EXPORT mechanism provides by exporter
A Module is a collection of related subroutines and data designed to be used by other programs or modules. Modules are defined in separate files and use the package keyword to define a namespace for the data and subroutines in that module file.
A Module can be a simple collection of subroutines, not defining a class. Such modules are referred to as libraries.
A Class is a user-defined data type. Classes are defined in modules using special constructs that allow you to create variables of that type. The subroutines in these modules are referred to as methods.
An Object is a variable that belongs to a particular class. It contains its own, private data that can be operated on by the methods defined in the class. The object is called an instance of its class.
Example:
- Module: Person.pm
- Class: Person
- Object: "Lincoln Stein"
- Method: surname()
What's up with all the double colons (::)? The :: corresponds to a filesystem path separator. A Module called Shape::Rect corresponds to a file named Shape/Rect.pm relative to a module library directory.
Perl comes with a large library of modules. In recent version it is essentially too big to be useful. But you can be selective.
As modules use their own namespace they cannot conflict with variable in your code and thus they enhance code reuse.
A huge archive of Perl modules CPAN (Comprehensive Perl Archive Network) was collected over the time.
Perl module - Wikipedia, the free encyclopedia
Perl Module Mechanics by Steven McDougall 2007 March 02
This page describes the mechanics of creating, compiling, releasing and maintaining Perl modules.This is not a reference manual. Rather, it is a running account of how to do these things. More to the point, it is an account of how I do these things. Accordingly
- It ignores XS
- Pathnames and other details may vary on your system
- You have to put up with a certain amount of editorializing
See also Perl Module Anatomy by Steven McDougall. Short and not very informative notes about the contents of the .pm file
The very very short tutorial about modules in Perl [ New: 06/16/99 ]Mark-Jason Dominus a really short tutorial about Perl Modules.
The Seven Useful Uses of local
perltoot - Tom Christiansen's object-oriented tutorial for perl
IBM developerWorks: Parsing with Perl modules(Apr 30, 2000)
Perl Module Primer By Dan Ragle
Perl module - Wikipedia, the free encyclopedia
Installing Your Own Perl Modules
Creating (and Maintaining) Perl Modules
Amazon.com- Perl Modules- Eric Foster-Johnson- Books
Perl Module Review- Class--Trait - O'Reilly ONLamp Blog
Writing Apache Modules with Perl and C - by Lincoln
D Stein - 744 pages
Learning Perl Objects References and Modules - by
Randal L Schwartz - 228 pages
| perlmod | Perl modules (packages and symbol tables) |
| perlref | Perl references and nested data structures |
| perlobj | Perl objects |
| perltoot | Tom's object-oriented tutorial for perl |
| perlbot | Bag'o Object Tricks (advanced stuff) |
Websites:
| genome-www.stanford.edu/perlOOP | A little collection I put together as I was learning Object-oriented Perl programming. See especially the examples page. |
| www.perl.com/CPAN/CPAN.html | CPAN homepage |
| search.cpan.org | Search CPAN for a module by author, category, or module name |
| bioperl.org | The Bioperl project - modules for bioinformatics |
Copyright © 1996-2009 by Dr. Nikolai Bezroukov. www.softpanorama.org was created as a service to the UN Sustainable Development Networking Programme (SDNP) in the author free time. Submit comments This document is an industrial compilation designed and created exclusively for educational use and is placed under the copyright of the Open Content License(OPL). Site uses AdSense so you need to be aware of Google privacy policy. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.
Disclaimer:
Last updated: October 10, 2009