X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngine%2FHTTP.pm;h=4ec9fb3b85dd78df723db702e330f0531dd4ebb4;hb=834d1575575a7841c37d87969dd749149de3c96b;hp=3201ed932dc3d62bfbaf5d765b6b64546aa644ff;hpb=ca61af20db58c67b3fa27e7277ed3aba5e2af829;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Engine/HTTP.pm b/lib/Catalyst/Engine/HTTP.pm index 3201ed9..4ec9fb3 100644 --- a/lib/Catalyst/Engine/HTTP.pm +++ b/lib/Catalyst/Engine/HTTP.pm @@ -1,9 +1,7 @@ package Catalyst::Engine::HTTP; use strict; -use base 'Catalyst::Engine::Test'; - -use IO::Socket qw(AF_INET); +use base 'Catalyst::Engine::HTTP::Daemon'; =head1 NAME @@ -27,63 +25,9 @@ A script using the Catalyst::Engine::HTTP module might look like: This is the Catalyst engine specialized for development and testing. -=head1 OVERLOADED METHODS - -This class overloads some methods from C. - -=over 4 - -=item $c->run - -=cut - -$SIG{'PIPE'} = 'IGNORE'; - -sub run { - my $class = shift; - my $port = shift || 3000; - - my $daemon = Catalyst::Engine::HTTP::Catalyst->new( - LocalPort => $port, - ReuseAddr => 1 - ); - - unless ($daemon) { - die("Failed to create daemon: $!\n"); - } - - my $base = URI->new( $daemon->url )->canonical; - - printf( "You can connect to your server at %s\n", $base ); - - while ( my $connection = $daemon->accept ) { - - while ( my $request = $connection->get_request ) { - - $request->uri->scheme('http'); # Force URI::http - $request->uri->host( $base->host ); - $request->uri->port( $base->port ); - - my $lwp = Catalyst::Engine::Test::LWP->new( - request => $request, - address => $connection->peerhost, - hostname => gethostbyaddr( $connection->peeraddr, AF_INET ) - ); - - $class->handler($lwp); - $connection->send_response( $lwp->response ); - } - - $connection->close; - undef($connection); - } -} - -=back - =head1 SEE ALSO -L, L. +L, L, L. =head1 AUTHOR @@ -97,13 +41,4 @@ the same terms as Perl itself. =cut -package Catalyst::Engine::HTTP::Catalyst; - -use strict; -use base 'HTTP::Daemon'; - -sub product_tokens { - "Catalyst/$Catalyst::VERSION"; -} - 1;