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 programme2.pl", but programme2.pl does not found $ENV{XX}.

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

Thanks in advance
Hector

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/programme2.pl';
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");
}
$fh->close;
exit 0;



--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Reply via email to