Geoffrey Young wrote:

I think we should go with get_config first of all, so we have the Apache like functionality and later on we can provide a shortcut with syntax sugar.


So we start with:
my $dir_cfg = $self->get_config($s, $r->per_dir_config);
my $srv_cfg = $self->get_config($s);

And then we can have something like headers_out-like (APR::Table) interface, though read-only.

$parse_headers_is_on = $dir_cfg->perl_options->get('ParseHeaders');
$parse_headers_is_on = $dir_cfg->perl_options->{'ParseHeaders'};
%srv_perl_options = %{ $srv_cfg->perl_options() };

What do you think?


coolio - APR::Table was what I had in mind.

But that won't be an APR::Table, because the data is not stored in apr_table. Just the interface will be somewhat similar.


the only difference I was trying to suggest is that, if possible, it would be nice to have a generic interface for all directives. however, I guess this isn't really practical since the majority of the directives contain data private to modules other than core.

When I get to implement this I'll post a patch and then we will see if can do it differently. The main issue with generic interface is that accessing other modules/core configuration requires walking the configuration tree, which is slow. And you can already do so, without adding any new API. perl_options() gives us a much faster access, since we can access these fields in memory. Also I think we can have things like $cfg->perl_switches, etc available as well.


so, yeah, I think your suggestion works best :)

Thanks for the feedback, Geoff ;)


In addition to the readonly dir and srv cfgs, there is request cfg, which includes things which are set up only for the request's life, and therefore writable. So we could have a read-write access to it. In that case turning off headers parsing would be as simple as:

$rcfg->perl_options->{ParseHeaders} = 0; # turn headers parsing off

and we should be able to turn them on, internally from the mod_perl handler, without using PerlOptions +ParseHeaders in httpd.conf.

$rcfg->perl_options->{ParseHeaders} = 1; # turn headers parsing on

__________________________________________________________________
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


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to