You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Torsten Förtsch <to...@gmx.net> on 2010/03/09 10:12:36 UTC

Apache::Test hooks?

Hi,

for my current project I need an additional server process to run to run my 
tests. What I came up with is this (snippet from t/TEST.PL):

use Apache::TestTrace;
use Apache::TestServer ();
BEGIN {
  no warnings 'redefine';
  my $orig_start=\&Apache::TestServer::start;
  *Apache::TestServer::start=sub {
    my $rc=$orig_start->(@_);
    if( $rc ) {
      notice "Starting sessionserver";
    }
    return $rc;
  };

  my $orig_stop=\&Apache::TestServer::stop;
  *Apache::TestServer::stop=sub {
    my $rc=$orig_stop->(@_);
    if( $rc!=-1 ) {
      notice "Stopping sessionserver";
    }
    return $rc;
  };
}

Is that the right way to go?

Torsten Förtsch

-- 
Need professional modperl support? Hire me! (http://foertsch.name)

Like fantasy? http://kabatinte.net