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):
- URI
- MIME::Base64
- HTML::Parser
- libnet
- Digest::MD5
- HTML::Tagset
- LWP::UserAgent
@INC contains the following:
- /usr/lib/perl5/5.005/i386-linux
- /usr/lib/perl5/5.005
- /usr/local/lib/site_perl/i386-linux
- /usr/local/lib/site_perl/
- /usr/lib/perl5
Perl 5.00503
Debian GNU/Linux 2.2r6
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.