12.5 The Differences Between OO and Non-OO Modules


A primarily OO module is distinguished from a primarily non-OO module in two ways:

  • A primarily OO module has functions that are meant to be called as a class methods , possibly returning instances upon which you issue further instance method calls.

  • A primarily non-OO module generally doesn't export any functions at all, making the import list rather irrelevant.

Because methods of the OO module are meant to be called as class methods, they should all set aside their first argument, which is the class name. This class name blesses a new instance but is otherwise ignored. Thus, you should not call OO modules as if they were functional modules, and vice versa. Stick with the design of the module.



Learning Perl Objects, References & Modules
Learning Perl Objects, References, and Modules
ISBN: 0596004788
EAN: 2147483647
Year: 2003
Pages: 199

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net