Hello Monks I am taking baby steps in creating a Boss/Worker threading I have liberally used the example at Re: Perl Threads Boss/Worker Example to create the following:

my ($accessToken, $appId, $userId) = (shift, shift, shift); use threads; use Thread::Queue; use WWW::Curl::Easy; use WWW::Curl::Form; my $threadLimit = 1; my $testUsers=listTestUsersFull($accessToken, $appId); my $q = Thread::Queue->new(); # A new empty queue # Worker threads my @thr = map { threads->create(sub { while (my @item = $q->dequeue(2)) { # assuming undef isn't a valid value and so can be a marker. last unless defined $item[0]; last unless defined $item[1]; deleteUser($item[1], $appId, $item[0]); } } , $appId )->detach(); } 1..$threadLimit; # Send work to the threads @testUsers = @testUsers[1..5]; foreach (keys %{$testUsers}){ $q->enqueue($userId, $$testUsers{$userId}->{access_token}); } # send markers. $q->enqueue(undef) for (1..$threadLimit); # terminate. $_->join() for @thr;

the deleteUser subroutine calls another which contains

use WWW::Curl::Easy; use WWW::Curl::Form;
, thus sending a simple form. My problem is the subroutine with those WWW::Curl:: calls returns at the line that posts the form:  my $response = $curl->perform; however when called via a non-threaded subroutine, everything just works. The documentation for WWW::Curl states threading is hopefully possible.

I am hoping to gain some wisdom on my problem, I thank you!


In reply to Thread::Queue and WWW::Curl by Anonymous Monk

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.