And more lucky escapes 

package Test::ApacheMechanize;

use strict;
use warnings;

use Apache::TestRequest;
use base 'Test::WWW::Mechanize';

sub new {
    my $class = shift;

    my $self = $class->SUPER::new( keep_alive => 1, @_ );

    my($url, $pass, $keep) = Apache::TestRequest::prepare('/'); # XXX $pass, $keep are useful?
    my $response = $self->get( $url ); # set base url

    die $response->as_string unless $response->is_success;

    return $self;
}

1;