On Tue Apr 29 14:35:15 2008, logan@dminteractive.com wrote:
Show quoted text> Hi again,
>
> I tried following the example in Curl.pm for the Multi interface, but
> I don't seem to be getting anything back from $curlm->info_read.
> Attached is a small test program, is there a trick to it?
>
> Thanks,
>
> Mike
Yeah, writing correct documentation ;)
The example provided with WWW::Curl is wrong.
The "while (my $active_transfers = $curlm->perform) {" part is entirely
incorrect. ->perform is a non-blocking operation in this case and
perform needs to be called periodically while there are active handles.
The trouble was that $active_transfers reflects the state after the
perform operation, which means that after all the http operations
finished, it returns 0, but there wasn't a chance to collect the data yet.
So it should read "while ($active_handles) { my $active_transfers =
$curlm->perform; ... }", or alternatively create a tight perform loop
and after the active count reached zero, just walk through the curl
handles to grab the information.
I'm going to release 4.01 soon, which should fix this.