push @{"$caller\::ISA"}, $self;
}
+ if ( $caller->engine ) {
+ return; # Catalyst is allready initialized
+ }
+
unless ( $caller->log ) {
$caller->log( Catalyst::Log->new );
}
# Engine
$engine = "Catalyst::Engine::$ENV{CATALYST_ENGINE}"
if $ENV{CATALYST_ENGINE};
+
+ if ( $engine eq 'Catalyst::Engine::Server' ) {
+ $engine = 'Catalyst::Engine::HTTP::Daemon';
+ $caller->log->warn( "Catalyst::Engine::Server is deprecated, "
+ . "using Catalyst::Engine::HTTP::Daemon." );
+ }
+
$engine->require;
die qq/Couldn't load engine "$engine", "$@"/ if $@;
{
-package Catalyst::Engine::LWP::Daemon;
+package Catalyst::Engine::HTTP::Daemon;
use strict;
use base 'Catalyst::Engine::LWP';
=head1 NAME
-Catalyst::Engine::LWP::Daemon - Catalyst LWP Daemon Engine
+Catalyst::Engine::HTTP::Daemon - Catalyst HTTP Daemon Engine
=head1 SYNOPSIS
-A script using the Catalyst::Engine::LWP::Daemon module might look like:
+A script using the Catalyst::Engine::HTTP::Daemon module might look like:
#!/usr/bin/perl -w
BEGIN {
- $ENV{CATALYST_ENGINE} = 'LWP::Daemon';
+ $ENV{CATALYST_ENGINE} = 'HTTP::Daemon';
}
use strict;
my $class = shift;
my $port = shift || 3000;
- my $daemon = Catalyst::Engine::LWP::Daemon::Catalyst->new(
+ my $daemon = Catalyst::Engine::HTTP::Daemon::Catalyst->new(
LocalPort => $port,
ReuseAddr => 1
);
=cut
-package Catalyst::Engine::LWP::Daemon::Catalyst;
+package Catalyst::Engine::HTTP::Daemon::Catalyst;
use strict;
use base 'HTTP::Daemon';
sub prepare_cookies {
my $c = shift;
- if ( my $header = $c->lwp->request->header('Cookie') ) {
+ if ( my $header = $c->request->headers->header('Cookie') ) {
$c->req->cookies( { CGI::Simple::Cookie->parse($header) } );
}
}
+++ /dev/null
-package Catalyst::Engine::Server;
-
-use strict;
-use base 'Catalyst::Engine::LWP::Daemon';
-
-=head1 NAME
-
-Catalyst::Engine::Server - Catalyst Server Engine
-
-=head1 SYNOPSIS
-
-A script using the Catalyst::Engine::Server module might look like:
-
- #!/usr/bin/perl -w
-
- BEGIN {
- $ENV{CATALYST_ENGINE} = 'Server';
- }
-
- 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 SEE ALSO
-
-L<Catalyst>, L<Catalyst::Engine::LWP::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
-
-1;
$self->mk_file( "$script\/server.pl", <<"EOF");
$Config{startperl} -w
-BEGIN { \$ENV{CATALYST_ENGINE} = 'Server' }
+BEGIN { \$ENV{CATALYST_ENGINE} = 'HTTP::Daemon' }
use strict;
use Getopt::Long;
get('index.html');
# Run tests against a remote server
- CATALYST_REMOTE='http://localhost:3000/' prove -l lib/ t/
+ CATALYST_SERVER='http://localhost:3000/' prove -l lib/ t/
# Tests with inline apps need to use Catalyst::Engine::Test
package TestApp;
my ( $get, $request );
- if ( $ENV{CATALYST_REMOTE} ) {
+ if ( $ENV{CATALYST_SERVER} ) {
$request = sub { remote_request(@_) };
$get = sub { remote_request(@_)->content };
}
else {
$class->require;
+
unless ( $INC{'Test/Builder.pm'} ) {
die qq/Couldn't load "$class", "$@"/ if $@;
}
+ $class->import;
+
$request = sub { $class->run(@_) };
$get = sub { $class->run(@_)->content };
}
require LWP::UserAgent;
- my $remote = URI->new( $ENV{CATALYST_REMOTE} );
+ my $remote = URI->new( $ENV{CATALYST_SERVER} );
unless ( ref $request ) {