… | |
… | |
224 | } |
224 | } |
225 | } |
225 | } |
226 | |
226 | |
227 | =head2 use AnyEvent::Fork as a faster fork+exec |
227 | =head2 use AnyEvent::Fork as a faster fork+exec |
228 | |
228 | |
229 | This runs C</bin/echo hi>, with stdandard output redirected to /tmp/log |
229 | This runs C</bin/echo hi>, with standard output redirected to F</tmp/log> |
230 | and standard error redirected to the communications socket. It is usually |
230 | and standard error redirected to the communications socket. It is usually |
231 | faster than fork+exec, but still lets you prepare the environment. |
231 | faster than fork+exec, but still lets you prepare the environment. |
232 | |
232 | |
233 | open my $output, ">/tmp/log" or die "$!"; |
233 | open my $output, ">/tmp/log" or die "$!"; |
234 | |
234 | |
… | |
… | |
595 | $_[0][PID] |
595 | $_[0][PID] |
596 | } |
596 | } |
597 | |
597 | |
598 | =item $proc = $proc->eval ($perlcode, @args) |
598 | =item $proc = $proc->eval ($perlcode, @args) |
599 | |
599 | |
600 | Evaluates the given C<$perlcode> as ... perl code, while setting C<@_> to |
600 | Evaluates the given C<$perlcode> as ... Perl code, while setting C<@_> to |
601 | the strings specified by C<@args>, in the "main" package. |
601 | the strings specified by C<@args>, in the "main" package. |
602 | |
602 | |
603 | This call is meant to do any custom initialisation that might be required |
603 | This call is meant to do any custom initialisation that might be required |
604 | (for example, the C<require> method uses it). It's not supposed to be used |
604 | (for example, the C<require> method uses it). It's not supposed to be used |
605 | to completely take over the process, use C<run> for that. |
605 | to completely take over the process, use C<run> for that. |
… | |
… | |
871 | initialising them, for example, by calling C<init Gtk2> manually. |
871 | initialising them, for example, by calling C<init Gtk2> manually. |
872 | |
872 | |
873 | =item exiting calls object destructors |
873 | =item exiting calls object destructors |
874 | |
874 | |
875 | This only applies to users of L<AnyEvent::Fork:Early> and |
875 | This only applies to users of L<AnyEvent::Fork:Early> and |
876 | L<AnyEvent::Fork::Template>, or when initialiasing code creates objects |
876 | L<AnyEvent::Fork::Template>, or when initialising code creates objects |
877 | that reference external resources. |
877 | that reference external resources. |
878 | |
878 | |
879 | When a process created by AnyEvent::Fork exits, it might do so by calling |
879 | When a process created by AnyEvent::Fork exits, it might do so by calling |
880 | exit, or simply letting perl reach the end of the program. At which point |
880 | exit, or simply letting perl reach the end of the program. At which point |
881 | Perl runs all destructors. |
881 | Perl runs all destructors. |
… | |
… | |
908 | |
908 | |
909 | =head1 SEE ALSO |
909 | =head1 SEE ALSO |
910 | |
910 | |
911 | L<AnyEvent::Fork::Early> (to avoid executing a perl interpreter), |
911 | L<AnyEvent::Fork::Early> (to avoid executing a perl interpreter), |
912 | L<AnyEvent::Fork::Template> (to create a process by forking the main |
912 | L<AnyEvent::Fork::Template> (to create a process by forking the main |
913 | program at a convenient time). |
913 | program at a convenient time), L<AnyEvent::Fork::RPC> (for simple RPC to |
|
|
914 | child processes). |
914 | |
915 | |
915 | =head1 AUTHOR AND CONTACT INFORMATION |
916 | =head1 AUTHOR AND CONTACT INFORMATION |
916 | |
917 | |
917 | Marc Lehmann <schmorp@schmorp.de> |
918 | Marc Lehmann <schmorp@schmorp.de> |
918 | http://software.schmorp.de/pkg/AnyEvent-Fork |
919 | http://software.schmorp.de/pkg/AnyEvent-Fork |