You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Peram, Sudhakara" <Su...@pfizer.com> on 2010/12/11 23:35:44 UTC

mod_perl 2 - %ENV variable

Hi

 

I am migrating a web application from mod_perl 1.21 to mod_perl 2.0.4,
Apache 1.3.9 to 2.2.17 and Perl5.005 to Perl5.12.2 . Operating system is
Sun Solaris 9.

 

The problem is that in most places the %ENV variable is used to pass
parameters to programs called via "system". Now these variables are not
found in the called program. 

 

 

E.g. 

 

Program 1 sets $ENV{XX) = "YY"; and executes "system 

programme2.pl", but programme2.pl does not found $ENV{XX}.

 

Any workaround? (The question is discussed in the documentation, but I
cannot find any concrete solution). I have gone through the following
link as well
http://perl.apache.org/docs/2.0/user/troubleshooting/troubleshooting.htm
l#C_Libraries_Don_t_See_C__ENV__Entries_Set_by_Perl_Code. Here it says
environ is not tied in mp2 due to threads issues. In our application we
are using ENV in so many places with different values for different
users logged into an application, so it is not possible to set up the
values at start up.

 

 

 

Test programs:

 

Program 1 (main)

 

#!/usr/bin/perl -w

use strict;

print "Content-type: text/plain\n\n";

 

$ENV{XX} = "YY";

for (sort keys %ENV) {

        print "\tENV{$_} => $ENV{$_}\n";

}

system ("/home/user/programme2.pl");

exit 0;

 

Program 2

 

#!/usr/bin/perl -w

use strict;

use FileHandle;

 

my $fh = new FileHandle;

$fh->open (">/var/tmp/p2.log") or die "can't open file";

for (sort keys %ENV) {

        $fh->print ("\2. ENV{$_} => $ENV{$_}\n");

}

$fh->close;

exit 0;

 

 

I tried to use Env::C module, but while installing make test is failed.
Below is the make test output.

 

Can't load 'blib/arch/auto/Env/C/C.so' for module Env::C: ld.so.1: perl:
fatal: relocation error: file blib/arch/auto/Env/C/C.so: symbol setenv:
referenced symbol not found at
~/lib/perl5/5.12.2/sun4-solaris-64int/DynaLoader.pm line 200

 

Irrespective of test result I have installed this module and tried to
set the env variable then I am getting the same error.

 

ld.so.1: perl: fatal: relocation error: file
~/lib/perl5/site_perl/5.12.2/sun4-solaris-64int/auto/Env/C/C.so: symbol
setenv: referenced symbol not found

 

 

Thank you in advance for your help and please let me know if any
additional information required.

 

 

Regards

Sudhakar

 

 


RE: mod_perl 2 - %ENV variable

Posted by "Peram, Sudhakara" <Su...@pfizer.com>.
Thank you Torsten Förtsch. I am not sure what options required for Env::C module, can you please let me know if you know any specific options.

Yes, I have multiple perl installations. But I am using correct installation only.

Thank you in advance.


--Sudhakar 

-----Original Message-----
From: Torsten Förtsch [mailto:torsten.foertsch@gmx.net] 
Sent: Sunday, December 12, 2010 3:53 AM
To: modperl@perl.apache.org
Cc: Peram, Sudhakara
Subject: Re: mod_perl 2 - %ENV variable

On Saturday, December 11, 2010 23:35:44 Peram, Sudhakara wrote:
> I tried to use Env::C module, but while installing make test is failed.
> Below is the make test output.
> 
>  
> 
> Can't load 'blib/arch/auto/Env/C/C.so' for module Env::C: ld.so.1: perl:
> fatal: relocation error: file blib/arch/auto/Env/C/C.so: symbol setenv:
> referenced symbol not found at
> ~/lib/perl5/5.12.2/sun4-solaris-64int/DynaLoader.pm line 200

Don't know about this error. Probably you have compiled perl with other 
settings than Env::C. Do you have multiple perl versions on the machine?

But Env::C is the only way that I know of to get around your problem.

Torsten Förtsch

-- 
Need professional modperl support? Hire me! (http://foertsch.name)

Like fantasy? http://kabatinte.net

Re: mod_perl 2 - %ENV variable

Posted by Torsten Förtsch <to...@gmx.net>.
On Saturday, December 11, 2010 23:35:44 Peram, Sudhakara wrote:
> I tried to use Env::C module, but while installing make test is failed.
> Below is the make test output.
> 
>  
> 
> Can't load 'blib/arch/auto/Env/C/C.so' for module Env::C: ld.so.1: perl:
> fatal: relocation error: file blib/arch/auto/Env/C/C.so: symbol setenv:
> referenced symbol not found at
> ~/lib/perl5/5.12.2/sun4-solaris-64int/DynaLoader.pm line 200

Don't know about this error. Probably you have compiled perl with other 
settings than Env::C. Do you have multiple perl versions on the machine?

But Env::C is the only way that I know of to get around your problem.

Torsten Förtsch

-- 
Need professional modperl support? Hire me! (http://foertsch.name)

Like fantasy? http://kabatinte.net