What is the difference between module and package?
Answer Posted / shankarreddy k
A module is basically a set of subroutines that are
designed to do a specific set of tasks, all with a common
goal/topic. You "use" modules in your Perl code and once
you do, their functions are available to you.
Now, say you have two modules that end up having two
functions with the same name, but do two completely
different things. You need to be able to tell them apart.
That is where the module, acts like a namespace.
For example, if modules "My::First::Module"
and "My::Second::Module" both have a function called "Count
()", but you need the version from "My::First::Module",
then you would specify that when you called the function,
like so:
My::First::Module::Count(options)
{
some code;
}
Ok, that is my take on this topic. Short and sweet.
Hopefully, if there is more, and I am sure there is, that
someone will enlighten not only you, but me as well.
Regards,
shankar
| Is This Answer Correct ? | 4 Yes | 7 No |
Post New Answer View All Answers
Which guidelines by Perl modules must be followed?
What are some common methods to all handles in perl?
What are the various advantages and disadvantages of perl?
What is the use of -w, -t and strict in Perl?
what is the main function of fork() in cgi programming?
How to find the length of an array in perl?
What are different data types that perl supports. Elaborate on them.
What is a chop() function in perl?
How to read a directory in perl?
What are the features of perl language?
Is there any way to add two arrays together?
What is the use of 'ne' operator?
What is 'rollback' command in perl?
What is the use of "stderr()"?
Explain a tell function in perl?