lokiloki has asked for the wisdom of the Perl Monks concerning the following question:
This works quite nicely on most servers... Most servers have LWP and the POST works fine. Some don't and they get the else message above. However, a few servers report the following error:if (eval "require LWP::UserAgent; 1") { my %post = ('key' => 'value'); my $ua = LWP::UserAgent->new(); my $content = $ua->post("http://www.mydomain/post.cgi",[%post])->a +s_string; #do something with the content ... } else { print "LWP not available"; }
How can I avoid this? Is the eval not a suitable way to test of LWP is available? Is there a better way to do this? Thanks so much...Can't locate object method "post" via package "LWP::UserAgent" (perhap +s you forgot to load "LWP::UserAgent"?) at (eval 2) line 1.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Testing if machine has LWP... not working
by ikegami (Patriarch) on Nov 22, 2006 at 02:06 UTC | |
|
Re: Testing if machine has LWP... not working
by GrandFather (Saint) on Nov 22, 2006 at 01:43 UTC | |
|
Re: Testing if machine has LWP... not working
by Cabrion (Friar) on Nov 22, 2006 at 01:44 UTC | |
by ikegami (Patriarch) on Nov 22, 2006 at 02:02 UTC | |
|
Re: Testing if machine has LWP... not working
by Anonymous Monk on Nov 22, 2006 at 15:31 UTC |