>>>>> "AL" == Andy Lester <[EMAIL PROTECTED]> writes:
>> For example, we use it at work for testing our web applications. The >> slightly overly-secure server we use for developing can not see the >> Internet, but it can test on localhost or other internal >> servers. (There's a local CPAN mirror and other such things to make it >> bearable). AL> I've created RT ticket #2185. If anyone would like to implement this AL> and submit the patch to me, I'd appreciate it. I'm fresh out of tuits AL> for implementing daemons on the fly. You can take mine which I wrote for a test suite in HTTP::WebTest. Feel free to steal code from HTTP::WebTest::Utils. There are two subs my $pid = start_webserver(port => $port, server_sub => $server_sub) and ($server_sub is a coderef on request handler) stop_webserver($pid); Typically they are used this way in t/*.t scripts: my $PID = start_webserver(port => $PORT, server_sub => \&server_sub); ... do tests ... END { stop_webserver($PID) if defined $PID } sub server_sub { my %param = @_; my $request = $param{request}; my $connect = $param{connect}; my $path = $request->url->path; # various test cases if($path eq '/test-file1' ) { $connect->send_file_response('t/test1.txt'); } elsif($path eq '/test-file2' ) { $connect->send_file_response('t/test2.txt'); } elsif($path eq '/status-forbidden') { $connect->send_error(RC_FORBIDDEN); } elsif($path eq '/show-request') { my $content = ''; $content .= 'Method: <' . $request->method . ">\n"; $content .= 'Query: <' . ($request->url->query || '') . ">\n"; $content .= 'Content: <' . $request->content . ">\n"; my $response = new HTTP::Response(RC_OK); $response->header(Content_Type => 'text/plain'); $response->content($content); } .... { } else { $connect->send_error(RC_NOT_FOUND); } } -- Ilya Martynov, [EMAIL PROTECTED] CTO IPonWEB (UK) Ltd Quality Perl Programming and Unix Support UK managed @ offshore prices - http://www.iponweb.net Personal website - http://martynov.org