Thanks to those who helped out with this.  Nobody quite got the case of
beer, but here's the final form, just in case anyone ever needs
something similar to this in the future.  It's pretty ugly still (and I
know there are some better ways for some of this), but I could see it
being useful in ISP/hosting situations.

//Thomas
Thomas K. Burkholder
[EMAIL PROTECTED]

<IfModule mod_perl.c>
  PerlInitHandler Apache::StatINC
  PerlModule Apache::DBI
  <perl>
    use IO::File;
    use Data::Dump;
#    use Apache::PerlSections ();
    # convert this to per-user match later
    while(my ($name,undef,undef,undef,undef,undef,undef,$dir) =
getpwent()) {
      my $filename = "$dir/perl/mod_perl_setup";
      my $file = IO::File->new("< $filename");
      if ($file) {
        my $inc = '';
 $_ = <$file>;
        s/(.*)\s*=\s*(.*)\s*$/$inc = "$1 $2"/e;
        my $pv = '';
        $_ = <$file>;
        s/(.*)\s*=\s*(.*)\s*$/$pv = "$1 $2"/e;
        while (<$file>) {
          my ($key, $value);
          s/(.*)\s*=\s*(.*)\s*$/($key, $value) = ($1,$2)/e;
#          print "mapping $key to $value\n";
          my %loc = (
            PerlSetEnv => $inc,
            PerlSetVar => $pv,
            SetHandler => 'perl-script',
            PerlHandler => $value
          );
          $Location{"$name/public_perl/$key"} = \%loc;
        }
        $file->close();
      }
    }
#    print Apache::PerlSections->dump;
    endpwent();
  </perl>
</IfModule>


Reply via email to