Re: Help me understand mod_perl and Environment settings

2003-07-17 Thread Ged Haywood
Hi there,

On Thu, 17 Jul 2003, Bernhard Donaubauer wrote:

> I just startet learning mod_perl and apache. I use the current version of 
> mod_perl 1 and apache 1.3. Perl itself has version 6.5.1.

Can you be a little more careful with your version numbers in future?

> but my testapplication does sometimes see my environment settings and 
> sometimes not. It changes if I press the refresh button of the browser.

Please see the mod_perl Guide at

http://perl.apache.org

There are references to the symptoms you see at

http://perl.apache.org/docs/1.0/guide/debug.html#Sometimes_My_Script_Works__Sometimes_It_Does_Not

73,
Ged.



Re: Help me understand mod_perl and Environment settings

2003-07-17 Thread Mike P. Mikhailov
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



Help me understand mod_perl and Environment settings

2003-07-17 Thread Bernhard Donaubauer
Hello!

I just startet learning mod_perl and apache. I use the current version of 
mod_perl 1 and apache 1.3. Perl itself has version 6.5.1.

My aim ist to set some environment variables visible to all apache/perl 
children (as far as I unsterstand there is one perl instance for each apache 
child), but my testapplication does sometimes see my environment settings and 
sometimes not. It changes if I press the refresh button of the browser.

According to mod_perl Developerls Cookbook I createt a script called 
envteststartup.pl:
  1 #!/usr/bin/env perl
  2
  3 BEGIN{
  4 $ENV{ORACLE_HOME}="/opt/oracle/product/9.2.0";
  5 $ENV{ORACLE_SID}="i001";
  6 $ENV{ORACLE_TERM}="xterm";
  7 $ENV{NLS_LANG}="AMERICAN_AMERICA.WE8ISO8859P1";
  8 
$ENV{ORA_NLS33}="/opt/oracle/product/9.2.0/ocommon/nls/admin/data";
  9 $ENV{NLS_TIMESTAMP_FORMAT}="-MM-DD HH24:MI:SS.FF";
 10 $ENV{NLS_TIMESTAMP_TZ_FORMAT}="-MM-DD HH24:MI:SS.FF TZR";
 11 $ENV{NLS_DATE_FORMAT}="-MM-DD";
 12 $ENV{NLS_NUMERIC_CHARACTERS}=",.";
 13 $ENV{TNS_ADMIN}="/opt/oracle/product/9.2.0/network/admin";
 14
 15 $ENV{INFORMIXDIR}="/opt/informix";
 16 $ENV{INFORMIXSERVER}="onltuxtcp";
 17 $ENV{DBDATE}="Y4MD-";
 18 $ENV{DBCENTURY}="C";
 19
 20 $ENV{BETLOGDIR}="/usr/local/apache/logs";
 21 $ENV{BETYUCDB}="yucatan_test1";
 22 $ENV{BETYUCDBTYP}="informix";
 23 $ENV{BETLOGIN}="login";
 24
 25 $ENV{SESSIONDIR}="/usr/local/apache/sessions";
 26 $ENV{SESSIONLOCKDIR}="/usr/local/apache/sessions/lock";
 27 }
 28
 29 use lib qw(/usr/local/apache/modperlappl);
 30 use lib qw(/usr/local/apache);
 31
 32 use strict;
 33 use warnings;
 34 use Apache::DBI;
 35 use DBI;
 36 use Apache::Session;
 37 use Apache::Session::File;
 38 use Apache::Request;
 39 use Apache::URI;
 40 use Apache::Log;
 41
 42 use envtest::handler;
 43
 44 1;

My http.conf has the following mod_perl entries:
338 PerlRequire conf/envteststartup.pl
339
340 Alias /envtest/ /usr/local/apache/modperlappl/envtest/
341 
342 SetHandler perl-script
343 PerlHandler envtest::handler
344 

My testapplication is as simple as can be:
  1 package envtest::handler;
  2
  3 sub handler {
  4 my $r=Apache::Request->instance(shift());
  5
  6 $r->send_http_header('text/plain');
  7
  8 print "Environment:\n";
  9
 10 while ( my ( $key, $value ) = each %ENV ) {
 11 print "$key: $value\n";
 12 }
 13
 14 }
 15
 16 1;

I assume not all perl instances get my environment settings but where is the 
error causing me headache?

Regards,
Bernhard Donaubauer