ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories  >>  Software  >>  Scripts  >>  CGI Perl
 
 


 

 
 PHP interview questions  PHP Interview Questions
 ASP interview questions  ASP Interview Questions
 CGI Perl interview questions  CGI Perl Interview Questions
 JavaScript interview questions  JavaScript Interview Questions
 VB Script interview questions  VB Script Interview Questions
 JSP interview questions  JSP Interview Questions
 Shell Script interview questions  Shell Script Interview Questions
 Python interview questions  Python Interview Questions
 Tcl interview questions  Tcl Interview Questions
 Awk interview questions  Awk Interview Questions
 AJAX interview questions  AJAX Interview Questions
 Ruby on Rails interview questions  Ruby on Rails Interview Questions
 Scripts AllOther interview questions  Scripts AllOther Interview Questions
Question
What is the difference between module and package?
 Question Submitted By :: Jay Mishra
I also faced this Question!!     Rank Answer Posted By  
 
  Re: What is the difference between module and package?
Answer
# 1
Modules and packages are usually used interchangeably. But 
there is a difference.

a. Packages are perl files with .pm extn and is considered 
a separate namespace. So a package is nothing but group of 
related scalars,arrays,hashes and subroutines for a 
specific purpose.Once a package is included in a .plx file
(using "use") and you want to call one of the subroutines 
of the package, you may have to use the scope resolution 
operator &package::subroutine1 ( as the subroutine of the 
package is in a separate name space).

b. Modules are packages but which has the capabilities of 
exporting selective subroutines/scalars/arrays/hashes of 
the package to the namespace of the main package itself. So 
for the interpreter these look as though the subroutines 
are part of the main package itself and so there is no need 
to use the scope resolution operator while calling them.

This is usually done like:

use Exporter;
our @ISA=('Exporter');
our @EXPORT=('$x','@arr',subroutine)

(you are exporting a scalar, array and a sub-routine from 
the package). So if some .plx is using the above package 
they need not use the scope resolution to call these.
A direct access like "print $x" would work even without 
using the scope resolution.
 
Is This Answer Correct ?    1 Yes 0 No
Savitha Sridhar
 

 
 
 
Other CGI Perl Interview Questions
 
  Question Asked @ Answers
 
i have a folder called 'error' and in that, i have error log files which are generated by the build, now i want to findout the string 'error' from each log file and that error has to be copied into the another file called 'analysis'. how do you do this in perl? HP4
Name an instance where you used a CPAN module? TCS3
what is the difference between require and use in perl? IBM1
what is the procedure to define a user define module in your perl application? IBM1
Explain the difference between use and require?  2
What does the command "use strict" do and why should you use it? TCS2
What?s your favorite module and why?  1
how to install a package in perl ????  1
What elements of the Perl language could you use to structure your code to allow for maximum re-use and maximum readability?  1
Why do you program in Perl?  1
How to find out the version of PERL being installed on your LINUX machine. Mind-Tree3
Can any1 tell me 2 write the script using perl script 2 looking at a log file 2 see wheather the test has passed or not. TCS2
I have created a CGI-based page,after entering all the values in to the fields, How to get the output on the web browser using Perl  4
Explain the difference between my and local?  1
How do you debug a Perl scripting ( at the compile time error or run time error) in Unix environment ?  4
What are the characteristics of a project that is well suited to Perl?  1
When would you not use Perl for a project?  1
what r the different type of function in perl ??? Symphony1
Write a script for 'count the no.of digits using regular expressions in perl.. AppLabs4
How can you create an object of a class in a package? IBM2
 
For more CGI Perl Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com