Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

    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


In reply to Can't locate object method new via package URI::URL by ybiC

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • 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.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-24 18:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found