Fixed typo in Engine::HTTP warning message
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Engine / HTTP.pm
index 9332745..b708a7f 100644 (file)
-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<Catalyst::Engine::Test>.
-
-=over 4
-
-=item $c->run
-
-=cut
-
-$SIG{'PIPE'} = 'IGNORE';
-
-sub run {
-    my $class = shift;
-    my $port  = shift || 3000;
+use warnings;
 
-    my $daemon = Catalyst::Engine::HTTP::Catalyst->new(
-        Listen    => SOMAXCONN,
-        LocalPort => $port,
-        ReuseAddr => 1,
-        Type      => SOCK_STREAM,
-    );
+use base 'Catalyst::Engine';
 
-    unless ($daemon) {
-        die("Failed to create daemon: $!\n");
-    }
+warn("You are loading Catalyst::Engine::HTTP explicitly.
 
-    my $base = URI->new( $daemon->url )->canonical;
+This is almost certainly a bad idea, as Catalyst::Engine::HTTP
+has been removed in this version of Catalyst.
 
-    printf( "You can connect to your server at %s\n", $base );
+Please update your application's scripts with:
 
-    while ( my $connection = $daemon->accept ) {
+  catalyst.pl -force -scripts MyApp
 
-        $connection->timeout(5);
+to update your scripts to not do this.\n") unless $ENV{HARNESS_ACTIVE};
 
-        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(
-                address  => $connection->peerhost,
-                hostname => gethostbyaddr( $connection->peeraddr, AF_INET ),
-                request  => $request,
-                response => HTTP::Response->new
-            );
-
-            $class->handler($lwp);
-            $connection->send_response( $lwp->response );
-
-            if ( $class->debug ) {
-                $class->log->info( sprintf( "Peer %s:%d",$connection->peerhost, $connection->peerport ) );
-            }
-
-        }
-
-        $connection->close;
-        undef($connection);
-    }
-}
-
-=back
-
-=head1 SEE ALSO
-
-L<Catalyst>, L<HTTP::Daemon>.
-
-=head1 AUTHOR
-
-Sebastian Riedel, C<sri@cpan.org>
-Christian Hansen, C<ch@ngmedia.com>
-
-=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;