stas        2004/05/12 17:34:09

  Modified:    perl-framework/Apache-Test/lib/Apache TestServer.pm
               perl-framework/Apache-Test Changes
  Log:
  Die if we fail to match the Apache revision. No more misleading
  defaults.
  
  Revision  Changes    Path
  1.83      +19 -6     
httpd-test/perl-framework/Apache-Test/lib/Apache/TestServer.pm
  
  Index: TestServer.pm
  ===================================================================
  RCS file: 
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestServer.pm,v
  retrieving revision 1.82
  retrieving revision 1.83
  diff -u -u -r1.82 -r1.83
  --- TestServer.pm     12 May 2004 23:52:04 -0000      1.82
  +++ TestServer.pm     13 May 2004 00:34:09 -0000      1.83
  @@ -22,6 +22,7 @@
   use File::Spec::Functions qw(catfile);
   
   use Apache::TestTrace;
  +use Apache::TestRun;
   use Apache::TestConfig ();
   use Apache::TestRequest ();
   
  @@ -54,12 +55,24 @@
   
       $self->{version} = $self->{config}->httpd_version || '';
       $self->{mpm}     = $self->{config}->httpd_mpm     || '';
  -    ($self->{rev})   = $self->{version} =~ m:^Apache/(\d)\.:;
  -    ($self->{rev})   = $self->{version} =~ m:^Apache.*?/(\d)\.:
  -        unless ($self->{rev});
  -    ($self->{rev})   = $self->{version} =~ m:^.*?Apache.*?/(\d)\.:
  -        unless ($self->{rev});
  -    $self->{rev}   ||= 2;
  +
  +    # try to get the revision number from the standard Apache version
  +    # string and various variations made by distributions which mangle
  +    # that string
  +    ($self->{rev})   = $self->{version} =~ m|^Apache/(\d)\.|;
  +    ($self->{rev}) ||= $self->{version} =~ m|^Apache.*?/(\d)\.|;
  +    ($self->{rev}) ||= $self->{version} =~ m|^.*?Apache.*?/(\d)\.|;
  +
  +    if ($self->{rev}) {
  +        debug "Matched Apache revision $self->{rev}";
  +    }
  +    else {
  +        # guessing is not good as it'll only mislead users
  +        # honestly admit that we have failed to match one
  +        error "can't figure out Apache revision, from string: " .
  +            "'$self->{version}'";
  +        Apache::TestRun::exit_perl(0);
  +    }
   
       $self;
   }
  
  
  
  1.130     +4 -1      httpd-test/perl-framework/Apache-Test/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/Changes,v
  retrieving revision 1.129
  retrieving revision 1.130
  diff -u -u -r1.129 -r1.130
  --- Changes   12 May 2004 23:52:04 -0000      1.129
  +++ Changes   13 May 2004 00:34:09 -0000      1.130
  @@ -8,7 +8,10 @@
   
   =item 1.11-dev
   
  -Improve the regex to match the Apache version out of 'httpd -v'
  +Die if we fail to match the Apache revision. No more misleading
  +defaults. [Stas]
  +
  +Improve the regex to match the Apache revision out of 'httpd -v'
   [Michael A Nachbaur <[EMAIL PROTECTED]>]
   
   -minclients is now what -maxclients used to be, -maxclients is now
  
  
  

Reply via email to