> -----Original Message-----
> From: Thomas K. Burkholder [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 17, 2001 6:40 AM
> To: [EMAIL PROTECTED]
> Subject: What the heck actually happens in a perl section?
> 
> 
> Hi again,
> 
> I'm still beating my head against perl sections.  Using PerlSetVar
> inside $Location seems really flaky - constants work, 
> variables vanish.
> And using $Location{$key} = {...} causes odd spurious 
> multiple-matching
> behaviour from a single matching hit.  Frankly, I'm at a loss.  I'm
> about ready to give up.  Anyone have any clue what the heck 
> really goes
> on inside <perl> sections?  I will personally overnight-fedex 
> a case of
> fine microbrewery beer with my compliments to anyone who can 
> show me how
> to make this work.  Really.

what is basically going on is that the contents of the <Perl> section are
being read into the Apache::ReadConfig namespace which then inserts
Apache::ReadConfig globals into the Apache configuration.

> 
> <IfModule mod_perl.c>
>   PerlSetEnv PERL5LIB /home/burkhold/perl/local/share/perl/5.6.0
>   PerlInitHandler Apache::StatINC
>   PerlModule Apache::DBI
>   # this should be put in a LocationMatch
>   <perl>
>     use IO::File;
>     use Data::Dump;
>     # convert this to per-user match later
>     my $filename = "/home/burkhold/perl/PerlSetVar";
>     my $file = IO::File->new("< $filename");
>     my @kv = ();
>     if ($file) {
>       while (<$file>) {
>         s/(\w+)\s*=\s*(.*)\s*$/push @kv, "$1 $2"/e;
>       }
>       $file->close();
>     }
>     my $mapping = getMapping();
>     my ($key, $value);
> # The following works
> #   $Location{'/areaj'} = {
> #      PerlSetVar => \@kv,

I'm surprised that this works at all...  what's in @kv at this point?  if
it's only two values then it might work if there is some magic behind the
scenes, but generally you can't store references in PerlSetVars without
having them stringified.  Maybe PerlAddVar would work for you, though...

maybe something like Apache::Storage would help as well...

for general debugging see man Apache::PerlSections and the
Apache::PerlSections->dump method.  There's also an entire section on
debugging <Perl> sections in the Eagle book.

HTH

--Geoff

 
[snip]

Reply via email to