Today I’ve sent an email to Michael Schwern, creator of ExtUtils::MakeMaker module asking for some help. In the subject line I wrote something like: “Need help from the God“.
This is his answer…
1. And God said unto ambs:
2. Blessed are the built-ins; for they shall work for all.
3. Blessed is require(); for it is simple and always works.
4. It shall forever and always find modules which have strayed from your flock
5. As long as they are in the eyes of @INC.
6. And God saw that ambs was troubled and he comforted him saying.
7. Rejoice and be glad for this is the keyword of the Lord.
8. And God finished the letter to ambs
9. And He saw that it was silly and that it was good.
10. And He closed His laptop and lay His crown upon the pillow
11. And in the third hour, He rested.
What else can I say?
PS: I am ‘ambs’. It is my CPAN nick.
Apparently I was very clever then, but I have no recollection of it!
FWIW we recently changed the way MakeMaker checks for dependencies to *not* use require and instead grovel through @INC itself and use MM->parse_version(). This is to avoid some side-effects of loading certain modules, but require() is still probably the best way to do it if you’re not MakeMaker.