Non-blocking / Asynchronous Execution in Perl

后端 未结 6 1953
刺人心
刺人心 2021-02-13 13:09

Is there a way to implement non-blocking / asynchronous execution (without fork()\'ing) in Perl?

I used to be a Python developer for many years... Python has really great

6条回答
  •  借酒劲吻你
    2021-02-13 13:33

    Twisted also uses cooperative multi-tasking just like POE & Coro.

    However it looks like Twisted Deferred does (or can) make use of threads. NB. See this answer from the SO question Twisted: Making code non-blocking

    So you would need to go the same route with POE (though using fork is probably preferable).

    So one POE solution would be to use: POE::Wheel::Run - portably run blocking code and programs in subprocesses.

    For alternatives to POE take a look at AnyEvent and Reflex.

提交回复
热议问题