Thursday, March 25, 2010

Use Vs Require in PERL

Bookmark and Share

This is the next one for differences in Use Vs Require that adds to my series of posts such as  Differences IPv4 Vs IPv6, Differences Routing Vs Routed protocol, SMTP Vs ESMTP, Load Testing Vs Stress Testing and IMAP Vs POP3.

Use

Require

Loads module at compile time Loads module/libraries at runtime
Imports symbols/semantics from module only one time Avoids redundant loading of ‘require’d files/symbols multiple times
Errors can be handled inside module itself. Terminates program if there are errors in ‘require’d file or if file is not found.
  Use Module;
equivalent to,
BEGIN {
  require Module; 
  import Module ; }
require ‘Module.pm’
Does not require file extension to use file Requires file extension (.pm) to ‘require’ file.

If you are aware of any improvements to above differences or want to add to the above list then please post your comments below.

Reblog this post [with Zemanta]

You may also be interested in,
+ Differences IPv4 Vs IPv6
+ Differences Routing Vs Routed protocol
+ HTML Vs HTML5

No comments:

Post a Comment

Your valuable comments are welcome. (Comments will be moderated.)

 




Technology