Return-Path: Delivered-To: apmail-httpd-test-dev-archive@httpd.apache.org Received: (qmail 80908 invoked by uid 500); 23 Dec 2001 16:43:26 -0000 Mailing-List: contact test-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: test-dev@httpd.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list test-dev@httpd.apache.org Received: (qmail 80895 invoked from network); 23 Dec 2001 16:43:25 -0000 Date: Mon, 24 Dec 2001 00:43:26 +0800 (SGT) From: Stas Bekman To: test-dev@httpd.apache.org Subject: [patch] better failure diagnostics for config token substitution Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N if the config token get mistyped, e.g. @servrename@ the current replace() sub will simply die without helping to locate which token is unknown to Apache-Test. This patch reports the offensive token (of course it'd be nice to tell which file it comes from but the current implementation doesn't allow that) Index: Apache-Test/lib/Apache/TestConfig.pm =================================================================== RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfig.pm,v retrieving revision 1.117 diff -u -r1.117 TestConfig.pm --- Apache-Test/lib/Apache/TestConfig.pm 2001/12/21 12:44:16 1.117 +++ Apache-Test/lib/Apache/TestConfig.pm 2001/12/23 16:36:50 @@ -755,7 +755,12 @@ sub replace { my $self = shift; - s/@(\w+)@/$self->{vars}->{lc $1}/g; + s[@(\w+)@] + [ my $key = lc $1; + exists $self->{vars}->{$key} + ? $self->{vars}->{$key} + : die qq{cannot substitute "\@$key\@" token} + ]ge; } #need to configure the vhost port for redirects and $ENV{SERVER_PORT} we could do simpler: + s[@(\w+)@] + [ $self->{vars}->{lc $1} + || die qq{cannot substitute "\@$1\@" token} + ]ge; But the value can be false (while valid), so it won't work for all cases. _____________________________________________________________________ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:stas@stason.org http://ticketmaster.com http://apacheweek.com http://singlesheaven.com http://perl.apache.org http://perlmonth.com/