-start-
>   Matthew Rochlin <[EMAIL PROTECTED]>
>at    05/30/2000 01:47 PM

>Thanks very much for your reply.   Your suggestion worked perfectly. 

>By the way, one of the difficulties I was having was that the perldocs 
for LWP::Parallel (and for the parallel UserAgent) don't explicitly 
describe the output of the "wait()" method (though the output is used in 
the examples).  That's strange since it's the whole potato.

>e.g. my $entries = $pua->wait();

>From your suggestion, this is my understanding ... $entries would be hash 
keyed with stuff that looks like HTTP::Request=HASH(0x8eee0c4) and  that 
each keyed value for the hash has the same structure as a vanilla 
UserAgent response object. (Can look at attributes code, message, headers, 
content -- methods is_success, is_error).

>I'll have to do a bit more experimenting (to see if $pua->in_order not 
only makes the requests in the order they appear but also returns them in 
that order).  Also, if there's a way of deriving the actual original 
request (URL) from the reference in the key.

The hash reference returned by the wait() method is a hash of 
LWP::Parallel::UserAgent::Entry objects using the string representation of 
each HTTP::Request object created, for the key.

This hash table of *::Entry objects is created when you use the 
$pua->register() method to insert new objects. $pua->wait() simply returns 
the hash once all the requests have been fullfilled.

The LWP::Parallel::UserAgent::Entry class has autoloaded methods to 
set/return any of its attributes. (which is good class encapsulation).

This means instead of 

my $val = $entryobj->{key}; # access the attribute directly

You're supposed to do

my $val = $entryobj->key(); # access the attribute via a public interface

The only two *::Entry object attributes that are of usefullness to you 
(the rest are really for internal use only) is 'request' and 'response' 
which both hold their respective objects.

Thus all the methods you need are provided in the response and request 
objects.

<snip>
my $res = $entries->{$_}->response;
my $req = $entries->{$_}->request;

if ($res->is_success) {
        print "URL: ", $req->url, " Response: ", $res->code, "\n";
}


Grant Hopwood.
Valero Energy Corp.
(210)370-2380
PGP Public Key: Ldap://certserver.pgp.com

---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
         [EMAIL PROTECTED]
For non-automated Mailing List support, send email to
         [EMAIL PROTECTED]

Reply via email to