You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs-cvs@perl.apache.org by st...@apache.org on 2002/11/29 08:16:19 UTC

cvs commit: modperl-docs/src/docs/2.0/user/troubleshooting troubleshooting.pod

stas        2002/11/28 23:16:19

  Modified:    src/docs/2.0/user/troubleshooting troubleshooting.pod
  Log:
  "C Libraries Don't See C<%ENV> Entries Set by Perl Code" problem and
  solutions cracked by Doug and Geoffrey
  
  Revision  Changes    Path
  1.2       +31 -0     modperl-docs/src/docs/2.0/user/troubleshooting/troubleshooting.pod
  
  Index: troubleshooting.pod
  ===================================================================
  RCS file: /home/cvs/modperl-docs/src/docs/2.0/user/troubleshooting/troubleshooting.pod,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- troubleshooting.pod	2 Sep 2002 06:40:29 -0000	1.1
  +++ troubleshooting.pod	29 Nov 2002 07:16:18 -0000	1.2
  @@ -43,7 +43,38 @@
   =head1 Runtime
   
   
  +=head2 C Libraries Don't See C<%ENV> Entries Set by Perl Code
   
  +For example some people have reported problems with C<DBD::Oracle>
  +(whose guts are implemented in C), which doesn't see environment
  +variables (like C<ORACLE_HOME>, C<ORACLE_SID>, etc.) set in the perl
  +script and therefore fails to connect.
  +
  +The issue is that the C array C<environ[]> is not thread-safe.
  +Therefore mod_perl 2.0 unties C<%ENV> from the underlying C<environ[]>
  +array under the
  +I<L<perl-script|docs::2.0::user::config::config/perl_script>> handler.
  +
  +The C<DBD::Oracle> driver or client library uses C<getenv()> (which
  +fetches from the C<environ[]> array).  When C<%ENV> is untied from
  +C<environ[]>, Perl code will see C<%ENV> changes, but C code will not.
  +
  +The I<L<modperl|docs::2.0::user::config::config/modperl>> handler does
  +not untie C<%ENV> from C<environ[]>. Still one should avoid setting
  +C<%ENV> values whenever possible.  And if it is required, should be
  +done at startup time.
  +
  +In the particular case of the C<DBD::> drivers, you can set the
  +variables that don't change (C<$ENV{ORACLE_HOME}> and
  +C<$ENV{NLS_LANG}> in the startup file, and those that change pass via
  +the C<connect()> method, e.g.:
  +
  +  my $sid      = 'ynt0';
  +  my $dsn      = 'dbi:Oracle:';
  +  my $user     = 'username/password';
  +  my $password = '';
  +  $dbh = DBI->connect("$dsn$sid", $user, $password)
  +      or die "Cannot connect: " . $DBI::errstr;
   
   
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: docs-cvs-unsubscribe@perl.apache.org
For additional commands, e-mail: docs-cvs-help@perl.apache.org