Thanks for the reply, just getting back from a short vacation...

My test programs:

first.pl
---
#!/export/home/eoliphan/gnu/bin/perl -w
use strict;
my $key;
open(LOG,"> /tmp/firstdebug.log");
foreach $key (keys %ENV)
{
    print LOG "$key = $ENV{$key} \n";
}

`/export/home/eoliphan/gnu/cgi-bin/dump_vars.pl`;
close (LOG);
---

dump_vars.pl has the same foreach loop and dumps to a different log file.
The 'firstdebug.log' has the required CGI vars.  The log generated by
dump_vars.pl has what appears to be the enviroment of the httpd executable
and no CGI vars.

Erich

----- Original Message -----
From: "Stas Bekman" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, January 09, 2003 10:01 PM
Subject: Re: Passing CGI environment to subprograms


> I don't see any reason why your `` invoked process doesn't see the CGI
> env vars. For example:
>
> #!/usr/bin/perl
> print "Content-type: text/plain\n\n";
> $ENV{'PATH'} = '/bin:/usr/bin';
> delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
> print qx{printenv |grep REMOTE_ADDR};
>
> prints:
> REMOTE_ADDR=127.0.0.1
>
> So as you can see, it works. The problem is probably in your external
> program, since the env vars are all there.
>
> Or may be you are using PerlSetEnv Off?
> http://perl.apache.org/docs/1.0/guide/config.html#PerlSetupEnv
>
> > I've now located and tried the subprocess_env() in conjunction w/
> > spawn_proc_prog().  I just do a foreach on the ENV hash and stuff
> > the values
> > into subprocess_env().  That works (I have a test perl subprogram
> > that just
> > dumps the ENV), but now I am not able to get the output of the program.
> > I
> > pasted in the read_data() func from the example and I have a single
> > scalar
> > accepting the return value from spawn_proc_prog() per the example
> > and that
> > is supposed to give me the output filehandle.
>
> Can you post a simple test program that reproduces the problem?
>
> Also it'd be really useful if somebody could add a test suite for
> Apache::Subprocess for (mod_perl 1.0). You can look at the
> t/apr/subprocess test in mod_perl 2.0 to a basic example. It's a good
> way to learn how to use Apache::Test, which is covered here:
> http://perl.apache.org/docs/general/testing/testing.html
>
> __________________________________________________________________
> Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
> http://stason.org/     mod_perl Guide ---> http://perl.apache.org
> mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
> http://modperlbook.org http://apache.org   http://ticketmaster.com
>
>


Reply via email to