Given the better example, and Dan's suggestion, can you please clarify how 
the callback routine is processed?

I had thought it was not invoked until the HTTP transaction has completed, 
but now I'm thinking that it's invoked as soon as the HTTP request is sent 
and then the code stalls in *$tx->result *until the request completes.
Is that correct?  If so then I guess Dan's suggestion would be coded as:

sub send_data {
    my $data = shift;
    my $ua = Mojo::UserAgent->new;
    my $request = $ua->post($upload_url => $data) => sub {
                                  my ($ua, $tx) = @_;
                                  my $localdata = $data;
                                  my $res = $tx->result;   # stall here 
until HTTP response is received
                                  post_process($localdata);
                                 });
    return $request;
}

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to