Taking this 17 steps back, although there is extensive documentation I have yet to fully grasp the difference between use and require. I know it well enough to explain to people who know less about perl than I do - but I don't truly understand.
Would someone, without quoting perldoc or sending me to RTFM, please explain the mechanics of the difference; all ramifications included. Best Regards, Dov Levenglick SmartDSP OS Development Leader -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Shmuel Fomberg Sent: Sunday, March 20, 2011 05:15 To: Perl in Israel Subject: Re: [Israel.pm] use and require On 2011/03/13 19:45, sawyer x wrote: > > Whenever I see 'require' used instead of 'use', I expect problems > in the > module-dependency tree. > > > I think there are benefits to both. It depends, as always, on your needs. > > If you have a healthy build process, you can use "require" instead of > "use" when you want to allow some features to be lazy, and that's very > useful. You can also allow loading two different versions of the same > mechanism, depending on some logic. If you have this, load that one, > if not, load this one. Imagine Mouse only uses Moose if it's already > loaded, saving you a ton on compile-time. While you are right, I think that these 'require' statements should be in very specific places. plugins finding and loading code, dynamic feature loading, and so on. but not littered through the code. Especially the main perl file, should 'use' all the modules that are known to be needed for running it. no point leaving it to later point of time. Shmuel. _______________________________________________ Perl mailing list [email protected] http://mail.perl.org.il/mailman/listinfo/perl _______________________________________________ Perl mailing list [email protected] http://mail.perl.org.il/mailman/listinfo/perl
