stas 2004/07/16 15:45:17 Modified: src/docs/2.0/api/Apache Process.pod SubProcess.pod Log: Apache::SubProcess manpage polish Revision Changes Path 1.5 +1 -1 modperl-docs/src/docs/2.0/api/Apache/Process.pod Index: Process.pod =================================================================== RCS file: /home/cvs/modperl-docs/src/docs/2.0/api/Apache/Process.pod,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- Process.pod 16 Jul 2004 21:36:52 -0000 1.4 +++ Process.pod 16 Jul 2004 22:45:17 -0000 1.5 @@ -29,7 +29,7 @@ C<Apache::Process> provides the API for the Apache process object, which you can retrieve with -C<L<$s-<Egt>process|docs::2.0::api::Apache::ServerRec/C_process_>>: +C<L<$s-E<gt>process|docs::2.0::api::Apache::ServerRec/C_process_>>: use Apache::ServerRec (); $proc = $s->process; 1.4 +43 -14 modperl-docs/src/docs/2.0/api/Apache/SubProcess.pod Index: SubProcess.pod =================================================================== RCS file: /home/cvs/modperl-docs/src/docs/2.0/api/Apache/SubProcess.pod,v retrieving revision 1.3 retrieving revision 1.4 diff -u -u -r1.3 -r1.4 --- SubProcess.pod 22 May 2004 02:03:27 -0000 1.3 +++ SubProcess.pod 16 Jul 2004 22:45:17 -0000 1.4 @@ -1,6 +1,10 @@ =head1 NAME -Apache::SubProcess -- Executing SubProcesses from mod_perl +Apache::SubProcess -- Executing SubProcesses under mod_perl + + + + =head1 Synopsis @@ -47,6 +51,11 @@ C<Apache::SubProcess> provides the Perl API for running and communicating with processes spawned from mod_perl handlers. +At the moment it's possible to spawn only external program in a new +process. It's possible to provide other interfaces, e.g. executing a +sub-routine reference (via C<B::Deparse>) and may be spawn a new +program in a thread (since the APR api includes API for spawning +threads, e.g. that's how it's running mod_cgi on win32). =head1 API @@ -54,18 +63,38 @@ =head2 C<spawn_proc_prog> - $out_fh = - Apache::SubProcess::spawn_proc_prog($r, $command, [EMAIL PROTECTED]); - ($in_fh, $out_fh, $err_fh) = - Apache::SubProcess::spawn_proc_prog($r, $command, [EMAIL PROTECTED]); +Spawn a sub-process and return STD communication pipes: + + $out_fh = $r->spawn_proc_prog($command); + $out_fh = $r->spawn_proc_prog($command, [EMAIL PROTECTED]); + ($in_fh, $out_fh, $err_fh) = $r->spawn_proc_prog($command); + ($in_fh, $out_fh, $err_fh) = $r->spawn_proc_prog($command, [EMAIL PROTECTED]); + +=over 4 + +=item obj: C<$r> +( C<L<Apache::RequestRec object|docs::2.0::api::Apache::RequestRec>> ) -spawn_proc_prog() spawns a sub-process which exec()'s C<$command> and -returns the output pipe filehandle in the scalar context, or input, -output and error pipe filehandles in the list context. Using these -three pipes it's possible to communicate with the spawned process. +=item arg1: C<$command> ( string ) -The third optional argument is a reference to an array which if passed -becomes ARGV to the spawned program. +The command to be C<$exec()>'ed. + +=item opt arg2: C<[EMAIL PROTECTED]> ( ARRAY ref ) + +A reference to an array of arguments to be passed to the process as +the process' C<ARGV>. + +=item ret: ... + +In SCALAR context returns the output filehandle of the spawned +process. + +In LIST context returns the input, outpur and error filehandles of the +spawned process. + +=item since: 1.99_15 + +=back It's possible to pass environment variables as well, by calling: @@ -88,10 +117,10 @@ Therefore to write a portable code, you want to use select for perlio-disabled Perl and do nothing for perlio-enabled Perl, hence you -can use something similar to the read_data() wrapper shown in the -L<SYNOPSIS|/SYNOPSIS> section. - +can use something similar to the C<read_data()> wrapper shown in the +L<Synopsis|/Synopsis> section. +Several examples appear in the L<Synopsis|/Synopsis> section.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]