I’m pretty new to this language but I’ve been using use to import a specific module before,
why LWP::UserAgent uses require to do the job as from perldoc LWP::UserAgent:
require LWP::UserAgent;
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
is the same as
If
require LWP::UserAgent;is acceptable, that goes to show thatimportdoes nothing for LWP::UserAgent. Maybe the point of the documentation’s use ofrequireis to subtly imply this?The only difference between
require LWP::UserAgent;anduse LWP::UserAgent;is thus whenrequireis executed. For the former, it happens after the entire file has been compiled. For the latter, it occurs as soon as that statement has been compiled. In practical terms, there’s no much difference for object-oriented modules.Personally, I use
That’s the same as
That way, I’m guaranteed not to import anything I don’t want, and I use the familiar
useI use for other modules.requireuse