perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Robinson <mar...@fulgentcorp.com>
Subject Re: mod_perl2 SubProcess no output from spawn_proc_prog in handler
Date Thu, 22 Jul 2010 17:01:05 GMT
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? 

thanks


On Jul 22, 2010, at 11:42 AM, Fred Moyer wrote:

> On Thu, Jul 22, 2010 at 9:34 AM, Mark Robinson <marcos@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-unsubscribe@perl.apache.org
>> For additional commands, e-mail: dev-help@perl.apache.org
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
> For additional commands, e-mail: dev-help@perl.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message