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


Please Help Members By Posting Answers For Below Questions

Explain join function in perl?

541


What are the logical operators used for small scale operations?

554


Mention the difference between die and exit in Perl?

666


how to create a flat file database as shown below s.no name age city phone 0 hema 22 Calcutta 4312542 1 hema 21 Bangalore 2344345 2 ganesh 25 delhi 2445454 3 kartik 45 pune 4312121 4 santosh 25 Hyderabad 2254231 5 kumar 25 mysore 2344567 6 gita 34 mangalore 6532123 7 gita 32 pune 2213456 Q1.print the details of the person who r from bangalore q2.Replace the city name managlore to pune q3.prints no of person having name gita and hema q4.print how many are of age 25.

1684


How can you call a subroutine and identify a subroutine?

508






What are the various perl data types based on the context?

544


What is perl scripting?

523


What does -> symbol indicates in Perl?

578


What are the various file operations in perl. Explain with example.

523


Why aren't Perl's patterns regular expressions?

601


Explain 'grep' function.

548


What is the use of strict?

548


In Perl, there are some arguments that are used frequently. What are that arguments and what do they mean?

538


what are the steps involved in reading a cgi script on the server?

508


What is perl unshift array function?

523