From: "Gary Hawkins" <[EMAIL PROTECTED]> > > > How many "things" can packages be? Is this foo a file? > > > > No this "foo" doesn't have to be a file. You can "have" several > > packages in one file and "switch" between them. > > > > I don't know how to explain what ARE packages though. > > Try if > > perldoc perlmod > > makes sense to you. > > After reading perldoc perlmod, my conclusion... > > 'package foo' is useful if one wants to: > > 1. Plug in someone else's code without any renaming (avoid vars with > same name where one side is too lazy to use strict). 2. Write obscure > code ('use', 'require', and '&coolsub' would be too easy for the > reader to understand). 3. Write a debugger. 4. Increase hair-pulling > on the planet. ;-> > > Aside from the function name, the term "package" has its more generic > meaning, often used in talking about modules (.pm files). (?) > > I was thinking there might be an instance where 'package bar' is > essential, or the best way to go.
Well usualy modules start with the "package ..." command. This helps the module authors to stay off other's data. And there is one more thing packages are good for ... objects: 1. An object is simply a reference that happens to know which class it belongs to. 2. A class is simply a package that happens to provide methods to deal with object references. 3. A method is simply a subroutine that expects an object reference (or a package name, for class methods) as the first argument. (from perldoc perlobj) So if a module defines several classes it has to contain several packages. Jenda =========== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ========== There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]