CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced: Re: [davorg] a muti-threaded web client in perl: Edit Log



mozkill
Novice

Mar 28, 2003, 3:56 PM


Views: 3458
Re: [davorg] a muti-threaded web client in perl

well, here is what i have so far in a .pm file:

-------------------------

package LWPThread;
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Response;
use strict;
use Carp;
use LWP::Debug qw(+conns);

sub new
{
my ($class) = @_;
my $ua_ref = LWP::UserAgent->new();
bless $ua_ref, $class;
testURL($ua_ref);
return 1;
}

sub testURL
{
my $ua_ref = shift;
$ua_ref->agent("perl-LWP\5.6.1");
my $url = 'http://web.pdx.edu/~jonw';
my $req = HTTP::Request->new(GET => $url);
my $res = $ua_ref->request($req);
my $code = $res->code;
my $content = $res->content;
if ($res->is_error()) {
printf "%s\n", $res->status_line;
} else {
my $content = $res->content();
}
printf $content;
}

1;
--------------------

and i call it from a perl file like so:

----------------

#! perl.exe -w
use lib "C:/Temp/mtlwp";
use LWPThread;
use strict;

LWPThread->new();


-----------------

in any case, i still cant get it to work. i am having a pass-by-reference issue that is hard to figure out. This code doesnt work "as is". I am still wrestling with it though. All i need is this simple little thing to work. :-(


(This post was edited by mozkill on Mar 28, 2003, 4:08 PM)


Edit Log:
Post edited by mozkill (Novice) on Mar 28, 2003, 3:58 PM
Post edited by mozkill (Novice) on Mar 28, 2003, 4:08 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives