… | |
… | |
35 | parallel access are rarely an issue, making coroutine programming much |
35 | parallel access are rarely an issue, making coroutine programming much |
36 | safer and easier than threads programming. |
36 | safer and easier than threads programming. |
37 | |
37 | |
38 | Unlike a normal perl program, however, coroutines allow you to have |
38 | Unlike a normal perl program, however, coroutines allow you to have |
39 | multiple running interpreters that share data, which is especially useful |
39 | multiple running interpreters that share data, which is especially useful |
40 | to code pseudo-parallel processes, such as multiple HTTP-GET requests |
40 | to code pseudo-parallel processes and for event-based programming, such as |
41 | running concurrently. |
41 | multiple HTTP-GET requests running concurrently. See L<Coro::AnyEvent> to |
|
|
42 | learn more. |
42 | |
43 | |
43 | Coroutines are also useful because Perl has no support for threads (the so |
44 | Coroutines are also useful because Perl has no support for threads (the so |
44 | called "threads" that perl offers are nothing more than the (bad) process |
45 | called "threads" that perl offers are nothing more than the (bad) process |
45 | emulation coming from the Windows platform: On standard operating systems |
46 | emulation coming from the Windows platform: On standard operating systems |
46 | they serve no purpose whatsoever, except by making your programs slow and |
47 | they serve no purpose whatsoever, except by making your programs slow and |