Hello,

I've partially tracked down a problem but I'm not sure if
it's a bug or if I'm just misusing the api.

The reason that I think it may be a bug is that I developed
my code with a dso mod_perl and it worked but it broke when
I started using a compiled in version (debian's apache-perl).

I wanted to access the PerlSetVar Auth_DBI_username (etc.)
from a module used by startup.pl so I did the following
in startup.pl (and it worked with the dso version):

 BEGIN {
    use Apache;
    my $dir = Apache->server->dir_config;
    $dir->set(Auth_DBI_username => 'myuser');
 }
 use SD::Test; 

I'm not sure if that's the best way or if it's even supposed
to work, nevertheless it leads to some weird problems.

Then in SD::Test (or the real module) I would access the dir_config
information.  with apache-perl-ctl I got "WARN1 .." with the correct
username then in the error.log I got WARN2 without the username and
with a different stringified Apache::Server.  However I DON'T get
the OR DIE message, it just disappears.  The symptom that made
me first notice this is that the %tied_before hash gets cleared
while the %tied_after one remains and remains tied.

 package SD::Test;
 use Apache;
 tie %tied_before, 'Tie::IxHash';
 $counter++;

 my $r = Apache->request || Apache->server;
 my $username = $r->dir_config('Auth_DBI_username') 
        or warn "No <$username>";
 warn "WARN$counter $username $r";
 $username or die "OR DIE $username";

 tie %tied_after, 'Tie::IxHash';
 %tied_after = (1,1);
 %tied_before = (2,2);

(Since I can move my ties I can work around the problem)

It doesn't matter if I use the module from startup.pl or
PerlModule in my config.  (I stripped the httpd.conf
right down, nothing else seems to effect this)

And the bonus symptom...adding this to my httpd.conf
fixes it also (no hash clearing)
<Perl> 
;
</Perl>

So it seems that my dodgy dir_config trick doesn't work in
the second attempt (I only know vaguely about this) and that
the die is hushed up, however the code before the die still
has global effects.  

My questions:
What is happening to the die?

Why is it different b/w dso & compiled versions?
(I noticed a similar problem with Apache::Template
directives not being recognized during the same
dso->compiled migration)

Is that use compile time dir_config supported?
(and should I be doing things differently?)

Thank you

Brad

PS.
This is all in a virtual host, in my testing there was only one.
Embedded Perl version v5.6.1 for Apache/1.3.26 (Unix) Debian GNU/Linux 
mod_perl/1.26


Reply via email to