perl-test-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r329537 - /perl/Apache-Test/trunk/lib/Apache/TestConfig.pm
Date Sun, 30 Oct 2005 06:36:33 GMT
Author: stas
Date: Sat Oct 29 23:36:30 2005
New Revision: 329537

URL: http://svn.apache.org/viewcvs?rev=329537&view=rev
Log:
use a callback to handle special tokens, instead of hardcoding each case, as suggested by
Geoff.

Modified:
    perl/Apache-Test/trunk/lib/Apache/TestConfig.pm

Modified: perl/Apache-Test/trunk/lib/Apache/TestConfig.pm
URL: http://svn.apache.org/viewcvs/perl/Apache-Test/trunk/lib/Apache/TestConfig.pm?rev=329537&r1=329536&r2=329537&view=diff
==============================================================================
--- perl/Apache-Test/trunk/lib/Apache/TestConfig.pm (original)
+++ perl/Apache-Test/trunk/lib/Apache/TestConfig.pm Sat Oct 29 23:36:30 2005
@@ -1111,6 +1111,10 @@
     }
 }
 
+my %special_tokens = (
+    nextavailableport => sub { shift->server->select_next_port }
+);
+
 sub replace {
     my $self = shift;
     my $file = $Apache::TestConfig::File
@@ -1118,8 +1122,8 @@
 
     s[@(\w+)@]
      [ my $key = lc $1;
-       if ($key eq 'nextavailableport') {
-           $self->server->select_next_port;
+       if (my $callback = $special_tokens{$key}) {
+           $self->$callback;
        }
        elsif (exists $self->{vars}->{$key}) {
            $self->{vars}->{$key};



Mime
View raw message