mod_perl 2 - %ENV variable
am 11.12.2010 23:35:44 von Sudhakara.PeramThis is a multi-part message in MIME format.
------_=_NextPart_001_01CB9983.C5E78882
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Hi
=20
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.
=20
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.=20
=20
=20
E.g.=20
=20
Program 1 sets $ENV{XX) =3D "YY"; and executes "system=20
programme2.pl", but programme2.pl does not found $ENV{XX}.
=20
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/trouble shooting.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.
=20
=20
=20
Test programs:
=20
Program 1 (main)
=20
#!/usr/bin/perl -w
use strict;
print "Content-type: text/plain\n\n";
=20
$ENV{XX} =3D "YY";
for (sort keys %ENV) {
print "\tENV{$_} =3D> $ENV{$_}\n";
}
system ("/home/user/programme2.pl");
exit 0;
=20
Program 2
=20
#!/usr/bin/perl -w
use strict;
use FileHandle;
=20
my $fh =3D new FileHandle;
$fh->open (">/var/tmp/p2.log") or die "can't open file";
for (sort keys %ENV) {
$fh->print ("\2. ENV{$_} =3D> $ENV{$_}\n");
}
$fh->close;
exit 0;
=20
=20
I tried to use Env::C module, but while installing make test is failed.
Below is the make test output.
=20
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
=20
Irrespective of test result I have installed this module and tried to
set the env variable then I am getting the same error.
=20
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
=20
=20
Thank you in advance for your help and please let me know if any
additional information required.
=20
=20
Regards
Sudhakar
=20
=20
------_=_NextPart_001_01CB9983.C5E78882
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:x=3D"urn:schemas-microsoft-com:office:excel" =
xmlns:p=3D"urn:schemas-microsoft-com:office:powerpoint" =
xmlns:a=3D"urn:schemas-microsoft-com:office:access" =
xmlns:dt=3D"uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" =
xmlns:s=3D"uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" =
xmlns:rs=3D"urn:schemas-microsoft-com:rowset" xmlns:z=3D"#RowsetSchema" =
xmlns:b=3D"urn:schemas-microsoft-com:office:publisher" =
xmlns:ss=3D"urn:schemas-microsoft-com:office:spreadsheet" =
xmlns:c=3D"urn:schemas-microsoft-com:office:component:spread sheet" =
xmlns:odc=3D"urn:schemas-microsoft-com:office:odc" =
xmlns:oa=3D"urn:schemas-microsoft-com:office:activation" =
xmlns:html=3D"http://www.w3.org/TR/REC-html40" =
xmlns:q=3D"http://schemas.xmlsoap.org/soap/envelope/" =
xmlns:rtc=3D"http://microsoft.com/officenet/conferencing" =
xmlns:D=3D"DAV:" xmlns:Repl=3D"http://schemas.microsoft.com/repl/" =
xmlns:mt=3D"http://schemas.microsoft.com/sharepoint/soap/mee tings/" =
xmlns:x2=3D"http://schemas.microsoft.com/office/excel/2003/x ml" =
xmlns:ppda=3D"http://www.passport.com/NameSpace.xsd" =
xmlns:ois=3D"http://schemas.microsoft.com/sharepoint/soap/oi s/" =
xmlns:dir=3D"http://schemas.microsoft.com/sharepoint/soap/di rectory/" =
xmlns:ds=3D"http://www.w3.org/2000/09/xmldsig#" =
xmlns:dsp=3D"http://schemas.microsoft.com/sharepoint/dsp" =
xmlns:udc=3D"http://schemas.microsoft.com/data/udc" =
xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema" =
xmlns:sub=3D"http://schemas.microsoft.com/sharepoint/soap/20 02/1/alerts/"=
xmlns:ec=3D"http://www.w3.org/2001/04/xmlenc#" =
xmlns:sp=3D"http://schemas.microsoft.com/sharepoint/" =
xmlns:sps=3D"http://schemas.microsoft.com/sharepoint/soap/" =
xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" =
xmlns:udcs=3D"http://schemas.microsoft.com/data/udc/soap" =
xmlns:udcxf=3D"http://schemas.microsoft.com/data/udc/xmlfile " =
xmlns:udcp2p=3D"http://schemas.microsoft.com/data/udc/partto part" =
xmlns:wf=3D"http://schemas.microsoft.com/sharepoint/soap/wor kflow/" =
xmlns:dsss=3D"http://schemas.microsoft.com/office/2006/digsi g-setup" =
xmlns:dssi=3D"http://schemas.microsoft.com/office/2006/digsi g" =
xmlns:mdssi=3D"http://schemas.openxmlformats.org/package/200 6/digital-sig=
nature" =
xmlns:mver=3D"http://schemas.openxmlformats.org/markup-compa tibility/2006=
" xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
xmlns:mrels=3D"http://schemas.openxmlformats.org/package/200 6/relationshi=
ps" xmlns:spwp=3D"http://microsoft.com/sharepoint/webpartpages" =
xmlns:ex12t=3D"http://schemas.microsoft.com/exchange/service s/2006/types"=
=
xmlns:ex12m=3D"http://schemas.microsoft.com/exchange/service s/2006/messag=
es" =
xmlns:pptsl=3D"http://schemas.microsoft.com/sharepoint/soap/ SlideLibrary/=
" =
xmlns:spsl=3D"http://microsoft.com/webservices/SharePointPor talServer/Pub=
lishedLinksService" xmlns:Z=3D"urn:schemas-microsoft-com:" =
xmlns:st=3D"" xmlns=3D"http://www.w3.org/TR/REC-html40">
charset=3Dus-ascii">
style=3D'font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>Hi
style=3D'font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>
style=3D'font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>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.
style=3D'font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>
style=3D'font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>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.
style=3D'font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>
style=3D'font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>
style=3D'font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>E.g.
style=3D'font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>
style=3D'font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>Program 1 sets $ENV{XX) =3D “YY”; and executes =
"system
style=3D'font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>programme2.pl", but programme2.pl does not found =
$ENV{XX}.
style=3D'font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>
style=3D'font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>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
href=3D"http://perl.apache.org/docs/2.0/user/troubleshooting /troubleshoot=
ing.html#C_Libraries_Don_t_See_C__ENV__Entries_Set_by_Perl_C ode">http://p=
erl.apache.org/docs/2.0/user/troubleshooting/troubleshooting .html#C_Libra=
ries_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.
style=3D'font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>
style=3D'font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>
style=3D'font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>
style=3D'font-size:10.0pt;
font-family:"Arial","sans-serif";color:#00B050'>Test =
programs:
style=3D'font-size:10.0pt;
font-family:"Arial","sans-serif";color:#00B050'>
/p>
style=3D'font-size:10.0pt;
font-family:"Arial","sans-serif";color:#00B050'>Program 1 =
(main)
style=3D'font-size:10.0pt;
font-family:"Arial","sans-serif";color:#00B050'>
/p>
style=3D'font-size:10.0pt;
font-family:"Arial","sans-serif";color:#00B050'>#!/usr/bin/p erl =
-w
style=3D'font-size:10.0pt;
font-family:"Arial","sans-serif";color:#00B050'>use =
strict;
style=3D'font-size:10.0pt;
font-family:"Arial","sans-serif";color:#00B050'>print =
"Content-type:
text/plain\n\n";
style=3D'font-size:10.0pt;
font-family:"Arial","sans-serif";color:#00B050'>
/p>
style=3D'font-size:10.0pt;
font-family:"Arial","sans-serif";color:#00B050'>$ENV{XX} =3D =
“YY”;
style=3D'font-size:10.0pt;
font-family:"Arial","sans-serif";color:#00B050'>for (sort keys %ENV) =
{
style=3D'font-size:10.0pt;
font-family:"Arial","sans-serif";color:#00B050'> &=
nbsp;
print "\tENV{$_} =3D> $ENV{$_}\n";
style=3D'font-size:10.0pt;
font-family:"Arial","sans-serif";color:#00B050'>}
style=3D'font-size:10.0pt;
font-family:"Arial","sans-serif";color:#00B050'>system
(“/home/user/programme2.pl”);
style=3D'font-size:10.0pt;
font-family:"Arial","sans-serif";color:#00B050'>exit =
0;
style=3D'font-size:10.0pt;
font-family:"Arial","sans-serif";color:#00B050'>
/p>
style=3D'font-size:10.0pt;
font-family:"Arial","sans-serif";color:#00B050'>Program =
2
style=3D'font-size:10.0pt;
font-family:"Arial","sans-serif";color:#00B050'>
/p>
style=3D'font-size:10.0pt;
font-family:"Arial","sans-serif";color:#00B050'>#!/usr/bin/p erl =
-w
style=3D'font-size:10.0pt;
font-family:"Arial","sans-serif";color:#00B050'>use =
strict;
style=3D'font-size:10.0pt;
font-family:"Arial","sans-serif";color:#00B050'>use =
FileHandle;
style=3D'font-size:10.0pt;
font-family:"Arial","sans-serif";color:#00B050'>
/p>
style=3D'font-size:10.0pt;
font-family:"Arial","sans-serif";color:#00B050'>my $fh =3D new =
FileHandle;
style=3D'font-size:10.0pt;
font-family:"Arial","sans-serif";color:#00B050'>$fh->open
(">/var/tmp/p2.log") or die “can’t open =
file”;
style=3D'font-size:10.0pt;
font-family:"Arial","sans-serif";color:#00B050'>for (sort keys %ENV) =
{
style=3D'font-size:10.0pt;
font-family:"Arial","sans-serif";color:#00B050'> &=
nbsp;
$fh->print ("\2. ENV{$_} =3D> =
$ENV{$_}\n");
style=3D'font-size:10.0pt;
font-family:"Arial","sans-serif";color:#00B050'>}
style=3D'font-size:10.0pt;
font-family:"Arial","sans-serif";color:#00B050'>$fh->close;
style=3D'font-size:10.0pt;
font-family:"Arial","sans-serif";color:#00B050'>exit =
0;
style=3D'font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>
style=3D'font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>
style=3D'font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>I tried to use Env::C module, but while installing make test =
is
failed. Below is the make test output.
style=3D'font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>
style=3D'font-size:10.0pt;
font-family:"Arial","sans-serif";color:red'>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
style=3D'font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>
style=3D'font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>Irrespective of test result I have installed this module and =
tried
to set the env variable then I am getting the same =
error.
style=3D'font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>
style=3D'font-size:10.0pt;
font-family:"Arial","sans-serif";color:red'>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
style=3D'font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>
style=3D'font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>
style=3D'font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>Thank you in advance for your help and please let me know if =
any
additional information required.
style=3D'font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>
style=3D'font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>
style=3D'color:blue'>Regards
style=3D'color:blue'>Sudhakar
style=3D'font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>
------_=_NextPart_001_01CB9983.C5E78882--