perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hèctor Alòs i Font <>
Subject mod_perl 2 / %ENV / "system" function
Date Mon, 07 Jun 2004 10:42:22 GMT
I'm migrating a web application from mod_perl 1 to mod_perl 2 [new 
environment: Apache/2.0.49 (Unix) mod_perl/1.99_14 Perl/v5.8.4].

The problem is that in some places the %ENV variable is used to pass 
parameters to programmes called via "system". Now these variables are 
not found in the called programme. E.g.

E.g. Programme 1 sets $ENV{XX) = 'YY' and executes "system", but does not found $ENV{XX}.

Any workarounds? (The question is discussed in the documentation, but I 
cannot find any concrete solution).

Thanks in advance

Test programmes:

Programme 1 (main)

#!/usr/bin/perl -w
use strict;
print "Content-type: text/plain\n\n";

$ENV{XX} = 'YYY';
for (sort keys %ENV) {
        print "\tENV{$_} => $ENV{$_}\n";
system '/export/home2/admnot.bck/cgi/search/';
exit 0;

Programme 2

#!/usr/bin/perl -w
use strict;
use FileHandle;

my $fh = new FileHandle;
$fh->open (">/var/tmp/p2.log") or die;
for (sort keys %ENV) {
        $fh->print ("\2. ENV{$_} => $ENV{$_}\n");
exit 0;

Report problems:
Mail list info:
List etiquette:

View raw message