Hello Bernhard Donaubauer,
Thursday, July 17, 2003, 5:34:57 PM, you wrote:
BD> Hello!
BD> I just startet learning mod_perl and apache. I use the current version of
BD> mod_perl 1 and apache 1.3. Perl itself has version 6.5.1.
BD> My aim ist to set some environment variables visible to all apache/perl
BD> children (as far as I unsterstand there is one perl instance for each apache
BD> child), but my testapplication does sometimes see my environment settings and
BD> sometimes not. It changes if I press the refresh button of the browser.
http://perl.apache.org/docs/1.0/guide/porting.html#Sometimes_it_Works__Sometimes_it_Doesn_t
BD> According to mod_perl Developerls Cookbook I createt a script called
BD> envteststartup.pl:
BD> 1 #!/usr/bin/env perl
BD> 2
BD> 3 BEGIN{
BD> 4 $ENV{ORACLE_HOME}="/opt/oracle/product/9.2.0";
BD> 5 $ENV{ORACLE_SID}="i001";
BD> 6 $ENV{ORACLE_TERM}="xterm";
BD> 7 $ENV{NLS_LANG}="AMERICAN_AMERICA.WE8ISO8859P1";
http://perl.apache.org/docs/1.0/guide/porting.html#BEGIN_blocks
BD> 8
BD> $ENV{ORA_NLS33}="/opt/oracle/product/9.2.0/ocommon/nls/admin/data";
BD> 9 $ENV{NLS_TIMESTAMP_FORMAT}="-MM-DD HH24:MI:SS.FF";
BD> 10 $ENV{NLS_TIMESTAMP_TZ_FORMAT}="-MM-DD HH24:MI:SS.FF TZR";
BD> 11 $ENV{NLS_DATE_FORMAT}="-MM-DD";
BD> 12 $ENV{NLS_NUMERIC_CHARACTERS}=",.";
BD> 13 $ENV{TNS_ADMIN}="/opt/oracle/product/9.2.0/network/admin";
BD> 14
BD> 15 $ENV{INFORMIXDIR}="/opt/informix";
BD> 16 $ENV{INFORMIXSERVER}="onltuxtcp";
BD> 17 $ENV{DBDATE}="Y4MD-";
BD> 18 $ENV{DBCENTURY}="C";
BD> 19
BD> 20 $ENV{BETLOGDIR}="/usr/local/apache/logs";
BD> 21 $ENV{BETYUCDB}="yucatan_test1";
BD> 22 $ENV{BETYUCDBTYP}="informix";
BD> 23 $ENV{BETLOGIN}="login";
BD> 24
BD> 25 $ENV{SESSIONDIR}="/usr/local/apache/sessions";
BD> 26 $ENV{SESSIONLOCKDIR}="/usr/local/apache/sessions/lock";
BD> 27 }
BD> 28
BD> 29 use lib qw(/usr/local/apache/modperlappl);
BD> 30 use lib qw(/usr/local/apache);
BD> 31
BD> 32 use strict;
BD> 33 use warnings;
BD> 34 use Apache::DBI;
BD> 35 use DBI;
BD> 36 use Apache::Session;
BD> 37 use Apache::Session::File;
BD> 38 use Apache::Request;
BD> 39 use Apache::URI;
BD> 40 use Apache::Log;
BD> 41
BD> 42 use envtest::handler;
BD> 43
BD> 44 1;
BD> My http.conf has the following mod_perl entries:
BD> 338 PerlRequire conf/envteststartup.pl
BD> 339
BD> 340 Alias /envtest/ /usr/local/apache/modperlappl/envtest/
BD> 341
BD> 342 SetHandler perl-script
BD> 343 PerlHandler envtest::handler
BD> 344
BD> My testapplication is as simple as can be:
BD> 1 package envtest::handler;
BD> 2
BD> 3 sub handler {
BD> 4 my $r=Apache::Request->instance(shift());
BD> 5
BD> 6 $r->send_http_header('text/plain');
BD> 7
BD> 8 print "Environment:\n";
BD> 9
BD> 10 while ( my ( $key, $value ) = each %ENV ) {
BD> 11 print "$key: $value\n";
BD> 12 }
BD> 13
BD> 14 }
BD> 15
BD> 16 1;
BD> I assume not all perl instances get my environment settings but where is the
BD> error causing me headache?
BD> Regards,
BD> Bernhard Donaubauer
Also see
http://perl.apache.org/docs/1.0/guide/config.html#PerlSetEnv_and_PerlPassEnv
http://perl.apache.org/docs/1.0/guide/config.html#PerlSetVar_and_PerlAddVar
http://perl.apache.org/docs/1.0/guide/config.html#PerlSetupEnv
Hope this will help.
--
WBR, Mike P. Mikhailov
mailto: [EMAIL PROTECTED]
ICQ:280990142