in reply to Re: LWP::UserAgent non-blocking calls
in thread LWP::UserAgent non-blocking calls

Maybe i'm doing something wrong or i'm not understanding how Future::HTTP works. But i can't get it to work in the background while the worker does other stuff.

It always returns false on $ua->is_async(). I can't change my event loop to a different type, and i don't see a way to poll Future::HTTP directly.

PerlMonks XP is useless? Not anymore: XPD - Do more with your PerlMonks XP
Also check out my sisters artwork and my weekly webcomics
  • Comment on Re^2: LWP::UserAgent non-blocking calls

Replies are listed 'Best First'.
Re^3: LWP::UserAgent non-blocking calls
by Corion (Patriarch) on Oct 22, 2024 at 10:42 UTC

    I fell into the trap myself. Future::HTTP uses whatever other event loop you already have loaded. If you have no event loop loaded, it uses HTTP::Tiny, which is synchronous.

    The "correct" approach is to load the event loop first (use IO::Async; (or whatever)) and then load/use HTTP::Future.

    I should make this more clear in the documentation resp. fix the usage so that this trap does not exist anymore.