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
What is epoch time in perl?
How to add elements in a hash in perl?
What is perl? What is the basic command to print a string in perl?
What is the importance of perl warnings?
Define print() function in perl?
What is automatic error handling in perl?
What is “grep” function in perl?
Explain the internal working of cgi
What syntax is used for grep() function?
Create a function that is only available inside the scope where it is defined ?
What is the use of '>>' in perl?
What are the different instances used in cgi overhead?
How do you you check the return code of a command in perl?
How will you open a file in a write-only mode in perl?
How many types of primary data structures in Perl and what do they mean?