Along these lines, can one still use $PerlConfig and @PerlConfig to store
Apache-style configuration directives?  (from within <Perl>..</Perl> blocks,
or alternatively from within a PerlRequire'd file?)

thanks
Eric



> -----Original Message-----
> From: Philippe M. Chiasson [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, January 20, 2004 1:11 PM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: perl sections howto?
> 
> 
> On Sat, 2004-01-17 at 15:55, Stas Bekman wrote:
> > gerard uolaquetalestem wrote:
> > > You were right, now i have this that works
> > > 
> > > PerlModule Apache2
> > > -----------------------------------
> > > <Perl >
> > > $Location{'~ .*log$'} = {
> > >   SetHandler => "perl-script",
> > >   PerlResponseHandler => "Blogum::UserLog",
> > >   PerlOptions => "+ParseHeaders",
> > >   Allow => "from all",
> > >   };
> > > </Perl>
> > [...]
> > > But now it doesn't work:
> > > PerlRequire ...archive.pl
> > > 
> > > inside archive.pl
> > > use Apache2();
> > > $Location{'~ .*log$'} = {
> > >   SetHandler => "perl-script",
> > >   PerlResponseHandler => "Blogum::UserLog",
> > >   PerlOptions => "+ParseHeaders",
> > >   Allow => "from all",
> > >   };
> > > 
> > > I've tried also with LocationMatch. Anything i'm doing wrong?
> > 
> > You mean you have moved the contents of that <Perl> section 
> to a perl 
> > file and
> > expect it to work? It has no idea what %main::Location is. 
> It needs to be in 
> > the special Apache::ReadConfig namespace. like:
> > 
> >    $Apache::ReadConfig::Location{....
> > 
> > though I think Philippe has changed things recently and I'm 
> not sure 
> > whether
> > the above will work.
> 
> Yes, this is still the way to do it for now. It should be 
> considered somewhat deprecated, but still works. 
> 
> > Philippe, what's the current state of things with perl section 
> > namespaces,
> > when people want to add config from perl, rather than 
> <Perl> sections? Should 
> > they do something like:
> > 
> >    my $file = __FILE__;
> >    my $namespace = "Apache::ReadConfig\::$file";
> >    ${"$namespace\::Location"}{foo} = {...};
> > 
> > We need to document this issue.
> 
> No need for this, really.  In the near future, playing directly with
> %Apache::ReadConfig:: _will_ be deprecated and issue a 
> warning of some sort. But before that will happen, there will 
> be a nice way to feed hashes-like configuration like:
> 
> $Location{'~ .*log$'} = {
>        SetHandler => "perl-script",
>        PerlResponseHandler => "Blogum::UserLog",
>        PerlOptions => "+ParseHeaders",
>        Allow => "from all",
>        };
> 
> Apache::PerlSection->read_hash(\%Location);
> 
> See the full thread about this future feature here:
> 
http://marc.theaimsgroup.com/?t=107100040400003&r=1&w=2

> But, Gerard, this should work for sure:
> 
> use Apache::ServerUtil ();
> my $config = <<EOI;
> <Perl >
> $Location{'~ .*log$'} = {
>       SetHandler => "perl-script",
>       PerlResponseHandler => "Blogum::UserLog",
>       PerlOptions => "+ParseHeaders",
>       Allow => "from all",
>       };
> </Perl>
> EOI
> Apache->server->add_config([split /\n/, $config]);
> 
> all it does is feeding the config section to the server, as if it was 
> written
> in httpd.conf.
> 
> __________________________________________________________________
> Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
> http://stason.org/     mod_perl Guide ---> http://perl.apache.org
> mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
> http://modperlbook.org http://apache.org   http://ticketmaster.com
-- 
--------------------------------------------------------------------------------
Philippe M. Chiasson /gozer\@(cpan|ectoplasm)\.org/ 88C3A5A5 (122FF51B/C634E37B)
http://gozer.ectoplasm.org/    F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3 A5A5
Q: It is impossible to make anything foolproof because fools are so ingenious. perl
-e'$$=\${gozer};{$_=unpack(P7,pack(L,$$));/^JAm_pH\n$/&&print||$$++&&redo}'


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html

Reply via email to