| [reply] [Watch: Dir/Any] |
| [reply] [Watch: Dir/Any] [d/l] |
For a beginner level view, which gets you thru most cases, a package is used inline
with the main source code; whearas when you want to put the package into a separate file, you call it a module. The nice thing about inline packages is that you don't need to worry about the location of the external file. Both ways allow you to create objects, or import functions and constants. It gets complicated, but the workings are very simple. As a matter of fact, you can take most conventional Perl modules and rip them apart into various packages and insert them directly into your script. I know this is over-simplified, but that is the answer I would have wanted to hear when I was first learning.
| [reply] [Watch: Dir/Any] |
| [reply] [Watch: Dir/Any] |
Thanks for providing the example link, but I posted my response as just a quick overview of what I see as the difference, in case the OP is not technically inclined enough to understand the Simple Module Tutorial. I remember when I first started
to learn Perl, back around 1998, I didn't give a thought to what objects were, or how they got there, back in those days, most scripts were written mostly as a monolithic collection of functions. Objects only confused beginners back then.I also just passed up reading all the links you posted, and failed to realize that what I said, was basically the topic of the Simple Module Tutorial, but in far less words. . Mea Culpa, Mea Culpa, Mea Maxima Culpa!. :-)
| [reply] [Watch: Dir/Any] |
Unfortunately for you, this distinction is mostly “an ambiguity or a confusion of terms.” In general (human-being ...) usage, these two words are pretty-much interchangeable. In the Perl language, though, package is a keyword and module is not.
Therefore, just consider the idea: Namely, that a great-big program can be subdivided into pieces, each one preceded by the package keyword, and that you can incorporate those pieces into other pieces by means of use. That’s “the big picture.™” Nevermind the terminology. The language-designers, long ago, had to choose one word versus the other.
| [reply] [Watch: Dir/Any] |