X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FEngine%2FHTTP.pm;h=b708a7ff0837a722401afeac5bb78acfcc5d3d19;hp=35c3c4468249b0054de896de2309cfd3d2f1eaf2;hb=5bf293276098f2b467162c75182eb3bc3f7b0119;hpb=03742cea7daff59ed41786a519d8ff7b0be75aad diff --git a/lib/Catalyst/Engine/HTTP.pm b/lib/Catalyst/Engine/HTTP.pm index 35c3c44..b708a7f 100644 --- a/lib/Catalyst/Engine/HTTP.pm +++ b/lib/Catalyst/Engine/HTTP.pm @@ -1,114 +1,23 @@ -package Catalyst::Engine::HTTP; - +package # Hide from PAUSE + Catalyst::Engine::HTTP; use strict; -use base 'Catalyst::Engine::Test'; - -use IO::Socket qw(AF_INET SOCK_STREAM SOMAXCONN); - -=head1 NAME - -Catalyst::Engine::HTTP - Catalyst HTTP Engine - -=head1 SYNOPSIS - -A script using the Catalyst::Engine::HTTP module might look like: - - #!/usr/bin/perl -w - - BEGIN { $ENV{CATALYST_ENGINE} = 'HTTP' } - - use strict; - use lib '/path/to/MyApp/lib'; - use MyApp; - - MyApp->run; - -=head1 DESCRIPTION - -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'; +use warnings; -sub run { - my $class = shift; - my $port = shift || 3000; +use base 'Catalyst::Engine'; - my $daemon = Catalyst::Engine::HTTP::Catalyst->new( - Listen => SOMAXCONN, - LocalPort => $port, - ReuseAddr => 1, - Timeout => .1, - Type => SOCK_STREAM, - ); +warn("You are loading Catalyst::Engine::HTTP explicitly. - unless ($daemon) { - die("Failed to create daemon: $!\n"); - } +This is almost certainly a bad idea, as Catalyst::Engine::HTTP +has been removed in this version of Catalyst. - my $base = URI->new( $daemon->url )->canonical; +Please update your application's scripts with: - printf( "You can connect to your server at %s\n", $base ); + catalyst.pl -force -scripts MyApp - while ( 1 ) { +to update your scripts to not do this.\n") unless $ENV{HARNESS_ACTIVE}; - my $connection = $daemon->accept or next; - - 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. - -=head1 AUTHOR - -Sebastian Riedel, C -Christian Hansen, C - -=head1 COPYRIGHT - -This program is free software, you can redistribute it and/or modify it under -the same terms as Perl itself. - -=cut - -package Catalyst::Engine::HTTP::Catalyst; +1; -use strict; -use base 'HTTP::Daemon'; +# This is here only as some old generated scripts require Catalyst::Engine::HTTP -sub product_tokens { - "Catalyst/$Catalyst::VERSION"; -} -1;