You are viewing a plain text version of this content. The canonical link for it is here.
Posted to test-dev@httpd.apache.org by Stas Bekman <st...@stason.org> on 2003/11/18 23:53:25 UTC
A-T: include resolution in httpd.conf
As mentioned before A-T doesn't handle properly absolute Include paths, consider:
httpd.conf
----------
...
Include "/home/httpd/2.0/perl/tutorial.conf"
% t/TEST -conf
setting ulimit to allow core files
ulimit -c unlimited; t/TEST -conf
configuration file
/home/stas/httpd/prefork/"/home/httpd/2.0/perl/tutorial.conf" does not exist
cleaning out current configuration
reconfiguration done
besides the fact that /home/httpd/2.0/perl/tutorial.conf does exist, the code
is not aware that optional quotes can be used when it tries to concat it to
the ServerRoot dir. so we probably need to do:
$path =~ s/^\s*["']?|["']?\s*$//g;
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
Re: A-T: include resolution in httpd.conf
Posted by Stas Bekman <st...@stason.org>.
André Malo wrote:
> * Stas Bekman <st...@stason.org> wrote:
>
>
>> $path =~ s/^\s*["']?|["']?\s*$//g;
>
>
> sounds reasonable.
> Doing this in two regexps instead of using the alternation is more efficient,
> however.
We probably don't care much about msecs during the config time ;) but I did
run the benchmark nevertheless ;)
perl /tmp/bench
Benchmark: timing 500000 iterations of one, two...
one: 35 wallclock secs (33.50 usr + 0.15 sys = 33.65 CPU) @
14858.84/s (n=500000)
two: 26 wallclock secs (25.22 usr + 0.09 sys = 25.31 CPU) @
19755.04/s (n=500000)
So yes, it's faster to do 2 separate regexes ;)
use Benchmark qw(:all) ;
my @data = qw(
"foo/bar/path/to/some/long/data/baz"
foo/bar/path/to/some/long/data/baz
foo/bar/baz
'foo/bar/baz'
);
my $count = 500000;
timethese($count, {
'one' => \&one,
'two' => \&two,
});
sub one {
my @copy = @data;
for (@copy) {
s/^\s*["']?|["']?\s*$//g;
}
}
sub two {
my @copy = @data;
for (@copy) {
s/^\s*["']?//;
s/["']?\s*$//;
}
}
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
Re: A-T: include resolution in httpd.conf
Posted by André Malo <nd...@perlig.de>.
* Stas Bekman <st...@stason.org> wrote:
> $path =~ s/^\s*["']?|["']?\s*$//g;
sounds reasonable.
Doing this in two regexps instead of using the alternation is more efficient,
however.
nd