What's is the use of 'require' and what does this mean?

Showing Answers 1 - 9 of 9 Answers

max1x

  • May 20th, 2006
 

require is a call to an external essential script or module, without which the current script/program will not proceed any further.

  Was this answer useful?  Yes

max1x

  • May 20th, 2006
 

require is a call to an external program/condition, that has to be met before the scrcipt/program can continue.

  Was this answer useful?  Yes

loginprompt

  • Jun 20th, 2006
 

load code from file at run-time

  Was this answer useful?  Yes

Vimaladevi

  • Jul 13th, 2006
 

require is a call to load in external funtions from a library at run time.

  Was this answer useful?  Yes

karthik

  • Aug 22nd, 2006
 

require loads the code at run time. if the require file is not listed in the directory it produces an fatal error.

  Was this answer useful?  Yes

Swanand

  • Mar 27th, 2007
 

'require' is like a preprocessor directive in C/C++ which imports the external file .
You can use the subroutines inside the current source code which are defined in the external file.

require 'coreDBlib.pl'
 =>> #include

  Was this answer useful?  Yes

nitashaa

  • Jul 15th, 2008
 

require function is used to load a seperate perl script or module in run time.If the file to be loaded is not in the directories listed in @INC array then full path of the perl file is to be passed in the require function .

ex . require "require.pl";
require "Mymodule.pm";
The location of perl file require.pl should be in directories listed in @INC.

otherwise give fullpath - require"/home/user/require.pl";

Once the perl file is loaded , %INC variable is updated with latest loaded perl file as key and its location as value .That's why before loading perl file ,require function checks if the file is already there in %INC.If file is there then it'll not load the file.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions