in reply to Related question: loading modules at run time
in thread How can I source other perl scripts from within a Perl script
If you wish to use the functions in LWP that way, you will have to do something like this:my $result=function_one sub function_one{ #blah, blah }
Ugh, ugly...probably better to try something like this:eval q( use LWP::UserAgent qw(whatever); my $ua=LWP::UserAgent::new; );
If you can manage to put a pair of parantheses after each method call, this will do:require LWP::UserAgent; import LWP::UserAgent(qw(whatever)); no strict subs; my $ua=LWP::UserAgent::New;
Notice that theres no need for a no strict subs when you tell perl that this is a function call.require LWP::UserAgent; import LWP::UserAgent(qw(whatever)); my $ua=LWP::UserAgent::new(); #continue doing what you do with LWP...
|
|---|