Pathologically Eclectic Rubbish Lister | |
PerlMonks |
use vs. require in LWP::Simpleby Xxaxx (Monk) |
on Apr 22, 2001 at 12:05 UTC ( [id://74551]=perlquestion: print w/replies, xml ) | Need Help?? |
Xxaxx has asked for the wisdom of the Perl Monks concerning the following question:
I'm working with LWP::Simple. I have a small subroutine which will read in a webpage. Since I'm only using this subroutine on rare occasions I've decided to use 'require' rather than 'use' so that I'm not always eating the overhead of loading the full LWP module. I am given to understand that require will load a module when the line is encountered during program flow and 'use' will load the module at the beginning. Please clue me in if that's not true. The following code works just fine: As one would expect. However this code does not work: I can make the code work just fine if I change it to: So, I can make the routine run okay. But sometimes just poking around until stuff works is not enough. It would be nice to understand better why the middle form of 'require' without the 'LWP::Simple::' in front of the get doesn't work.
Thanks in advance
Back to
Seekers of Perl Wisdom
|
|