- A package is a collection of methods
- Lives in its own namespace
- Package methods can be exported or called directly
- A module is a file containing one or more packages
- Most people use "module" and "package" interchangably
- An object is a
blessed reference to a hash
- It doesn't have to be a hash reference, but it's most common.
- Blessing assigns a single class to an object
- An object can be re-blessed
- You can muck with the internals, but that doesn't mean you should
- Modules must end with a true value
- It doesn't have to be 1
- Packages don't have the same restriction
Perl's object inheritance methods use
@ISA to determine what classes a module inherits from.
inheritance was declared by modifying
@ISA directly; now,
most programs use the base pragma to declare inheritance.
The following are mostly equivalent:
package Foo; require Wango; @ISA = ( "Wango" ); package Foo; use base "Wango";