… | |
… | |
304 | $cv->end; |
304 | $cv->end; |
305 | }); |
305 | }); |
306 | } |
306 | } |
307 | $cv->recv; |
307 | $cv->recv; |
308 | |
308 | |
309 | lhead1 CONCEPTS |
309 | CONCEPTS |
310 | |
|
|
311 | This module can create new processes either by executing a new perl |
310 | This module can create new processes either by executing a new perl |
312 | process, or by forking from an existing "template" process. |
311 | process, or by forking from an existing "template" process. |
313 | |
312 | |
314 | All these processes are called "child processes" (whether they are |
313 | All these processes are called "child processes" (whether they are |
315 | direct children or not), while the process that manages them is called |
314 | direct children or not), while the process that manages them is called |
… | |
… | |
443 | The path to the perl interpreter is divined using various methods - |
442 | The path to the perl interpreter is divined using various methods - |
444 | first $^X is investigated to see if the path ends with something |
443 | first $^X is investigated to see if the path ends with something |
445 | that sounds as if it were the perl interpreter. Failing this, the |
444 | that sounds as if it were the perl interpreter. Failing this, the |
446 | module falls back to using $Config::Config{perlpath}. |
445 | module falls back to using $Config::Config{perlpath}. |
447 | |
446 | |
|
|
447 | The path to perl can also be overriden by setting the global |
|
|
448 | variable $AnyEvent::Fork::PERL - it's value will be used for all |
|
|
449 | subsequent invocations. |
|
|
450 | |
448 | $pid = $proc->pid |
451 | $pid = $proc->pid |
449 | Returns the process id of the process *iff it is a direct child of |
452 | Returns the process id of the process *iff it is a direct child of |
450 | the process running AnyEvent::Fork*, and "undef" otherwise. |
453 | the process running AnyEvent::Fork*, and "undef" otherwise. |
451 | |
454 | |
452 | Normally, only processes created via "AnyEvent::Fork->new_exec" and |
455 | Normally, only processes created via "AnyEvent::Fork->new_exec" and |
… | |
… | |
575 | sub Some::function { |
578 | sub Some::function { |
576 | my ($fh, $str1, $str2, $fh1, $fh2, $str3) = @_; |
579 | my ($fh, $str1, $str2, $fh1, $fh2, $str3) = @_; |
577 | |
580 | |
578 | print scalar <$fh>; # prints "hi #1\n" and "hi #2\n" in any order |
581 | print scalar <$fh>; # prints "hi #1\n" and "hi #2\n" in any order |
579 | } |
582 | } |
|
|
583 | |
|
|
584 | EXPERIMENTAL METHODS |
|
|
585 | These methods might go away completely or change behaviour, at any time. |
580 | |
586 | |
581 | $proc->to_fh ($cb->($fh)) # EXPERIMENTAL, MIGHT BE REMOVED |
587 | $proc->to_fh ($cb->($fh)) # EXPERIMENTAL, MIGHT BE REMOVED |
582 | Flushes all commands out to the process and then calls the callback |
588 | Flushes all commands out to the process and then calls the callback |
583 | with the communications socket. |
589 | with the communications socket. |
584 | |
590 | |