On Thu, Jul 22, 2010 at 10:01 AM, Mark Robinson <mar...@fulgentcorp.com> wrote: > Hi Fred, > > I downloaded your example and same result: nothing. No error in the error log. > Is there a specification configuration needed in httpd.conf to use SubProcess?
I don't think there is anything specific needed. Did you try sending the output to the error log with $r->log->debug or something similar? Try different commands? > > thanks > > > On Jul 22, 2010, at 11:42 AM, Fred Moyer wrote: > >> On Thu, Jul 22, 2010 at 9:34 AM, Mark Robinson <mar...@fulgentcorp.com> >> wrote: >>> Hi all, >>> I am trying to figure out how to use spawn_proc_prog to execute an external >>> process and return the output of that process to the calling browser. >>> I am currently modifying the spawn_proc_prog example from the mod_perl 2 >>> API docs. >> >> I used spawn_proc_prog in this module, partially as an exercise, but >> it works just fine. >> >> http://search.cpan.org/dist/Apache2-Connection-Arp >> >> >>> >>> My perl script is this: >>> "package ModPerl::Rules2; >>> use Apache2::SubProcess (); >>> use Config; >>> use constant PERLIO_IS_ENABLED => $Config{useperlio}; >>> >>> sub read_data { >>> my ($fh) = @_; >>> my $data; >>> if (PERLIO_IS_ENABLED || IO::Select->new($fh)->can_read(10)) { >>> $data = <$fh>; >>> } >>> return defined $data ? $data : ''; >>> } >>> sub handler{ >>> my $r = shift; >>> my $cmd = "ls"; >>> my $out_fh = $r->spawn_proc_prog($cmd); >>> my $output = read_data($out_fh); >>> >>> print "output from spawn_proc_prog goes between this line:\n"; >>> print $output . "\n"; >>> print "and this line\n"; >>> >>> return Apache2::OK; >>> } >>> 1; # satisfy require()" >>> >>> >>> When I start Apache, everything starts fine: >>> "[Thu Jul 22 11:11:47 2010] [notice] Apache/2.2.14 (Unix) mod_ssl/2.2.14 >>> OpenSSL/0.9.8l DAV/2 mod_perl/2.0.4 Perl/v5.10.0 configured -- resuming >>> normal operations" >>> >>> When I call the script from my browser, I receive this: >>> "output from spawn_proc_prog goes between this line: >>> >>> and this line" >>> >>> So I know the handler is being called by Apache. And there is nothing new >>> in the Apache error log. >>> It is as if spawn_proc_prog ignores me. >>> >>> I am working on a Mac workstation 10.6.4 with the default installation of >>> Apache and mod_perl >>> >>> thanks! >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: dev-unsubscr...@perl.apache.org >>> For additional commands, e-mail: dev-h...@perl.apache.org >>> >>> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: dev-unsubscr...@perl.apache.org >> For additional commands, e-mail: dev-h...@perl.apache.org >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@perl.apache.org > For additional commands, e-mail: dev-h...@perl.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@perl.apache.org For additional commands, e-mail: dev-h...@perl.apache.org