Return-Path: Delivered-To: apmail-perl-dev-archive@www.apache.org Received: (qmail 81133 invoked from network); 22 Jul 2010 17:42:24 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 22 Jul 2010 17:42:24 -0000 Received: (qmail 98764 invoked by uid 500); 22 Jul 2010 17:42:23 -0000 Delivered-To: apmail-perl-dev-archive@perl.apache.org Received: (qmail 98706 invoked by uid 500); 22 Jul 2010 17:42:23 -0000 Mailing-List: contact dev-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@perl.apache.org Received: (qmail 98699 invoked by uid 99); 22 Jul 2010 17:42:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Jul 2010 17:42:23 +0000 X-ASF-Spam-Status: No, hits=0.7 required=10.0 tests=RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [74.125.83.177] (HELO mail-pv0-f177.google.com) (74.125.83.177) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Jul 2010 17:42:18 +0000 Received: by pvf33 with SMTP id 33so3374059pvf.22 for ; Thu, 22 Jul 2010 10:41:57 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.193.19 with SMTP id q19mr2735274wff.16.1279820517393; Thu, 22 Jul 2010 10:41:57 -0700 (PDT) Received: by 10.142.186.2 with HTTP; Thu, 22 Jul 2010 10:41:57 -0700 (PDT) In-Reply-To: <2C02C90B-239B-48F0-857D-1E3F2C382956@fulgentcorp.com> References: <2C02C90B-239B-48F0-857D-1E3F2C382956@fulgentcorp.com> Date: Thu, 22 Jul 2010 10:41:57 -0700 Message-ID: Subject: Re: mod_perl2 SubProcess no output from spawn_proc_prog in handler From: Fred Moyer To: Mark Robinson Cc: dev@perl.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Thu, Jul 22, 2010 at 10:01 AM, Mark Robinson wr= ote: > 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 SubPro= cess? 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 = wrote: >>> Hi all, >>> I am trying to figure out how to use spawn_proc_prog to execute an exte= rnal 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 =3D> $Config{useperlio}; >>> >>> sub read_data { >>> =A0 =A0 =A0 =A0my ($fh) =3D @_; >>> =A0 =A0 =A0 =A0my $data; >>> =A0 =A0 =A0 =A0if (PERLIO_IS_ENABLED || IO::Select->new($fh)->can_read(= 10)) { >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0$data =3D <$fh>; >>> =A0 =A0 =A0 =A0} >>> =A0 =A0 =A0 =A0return defined $data ? $data : ''; >>> } >>> sub handler{ >>> =A0 =A0 =A0 =A0my $r =3D shift; >>> =A0 =A0 =A0 =A0my $cmd =3D "ls"; >>> =A0 =A0 =A0 =A0my $out_fh =3D $r->spawn_proc_prog($cmd); >>> =A0 =A0 =A0 =A0my $output =3D read_data($out_fh); >>> >>> =A0 =A0 =A0 =A0print "output from spawn_proc_prog goes between this lin= e:\n"; >>> =A0 =A0 =A0 =A0print $output . "\n"; >>> =A0 =A0 =A0 =A0print "and this line\n"; >>> >>> =A0 =A0 =A0 =A0return 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.1= 4 OpenSSL/0.9.8l DAV/2 mod_perl/2.0.4 Perl/v5.10.0 configured -- resuming n= ormal 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 n= ew 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 > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org For additional commands, e-mail: dev-help@perl.apache.org