ybiC has asked for the wisdom of the Perl Monks concerning the following question:
Dear brothers and sisters in Perl,
I'm rewriting an existing codelet that nails up a dial connection via HTTP fetches, so that it randomly selects from a list of web pages to fetch and waits a random length of time between fetches. All fairly straightforward and no problems. That is, until I move the code from my workstation to the dial-connected firewall/proxy, where it fails to run and gives this error:
Can't locate object method "new" via package "URI::URL" at ./wtest.pl line 12
I've reinstalled URI, downgraded it to v1.17, upgraded it back to v1.18, all to no avail. It can't be left to run on my workstation, as it would only fetch from firewall's proxy instead of from the web. What other troubleshooting steps might you recommend?
Minimized code and additional details follow.
stymied, puzzled, baffled and perplexed,
Don
#!/usr/bin/perl -w # wtest.pl # 2002-04-16 ybiC $|++; require 5; use strict; use LWP::UserAgent; my $site = shift; my $url = new URI::URL($site); my $req = new HTTP::Request('GET', $url); my $ua = new LWP::UserAgent; my $resp = $ua->request($req); if ($resp->is_success) { # print $resp->content; print "Received response from $site\n"; } else { print "Error: ", $resp->message, "\n\n"; }
Relevant modules (all installed without a hitch):
@INC contains the following:
Perl 5.00503
Debian GNU/Linux 2.2r6
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Can't locate object method new via package URI::URL
by Fletch (Bishop) on Apr 16, 2002 at 15:00 UTC | |
|
Re: Can't locate object method new via package URI::URL
by tachyon (Chancellor) on Apr 16, 2002 at 16:09 UTC |