unless ($engine) {
$engine = $class->engine_class;
}
+ $engine = 'Catalyst::Engine::' . $engine
+ unless $engine =~ /^Catalyst::Engine/;
+
+ $engine = 'Catalyst::Engine' if $engine eq 'Catalyst::Engine::HTTP';
Class::MOP::load_class($engine);
=cut
sub run {
- my ($self, $app, $server, @args) = @_;
+ my ($self, $app, @args) = @_;
+ my $server = pop @args if blessed $args[-1];
$server ||= Plack::Loader->auto(); # We're not being called from a script,
# so auto detect what backend to run on.
# This does *NOT* cover mod_perl.
# FIXME - Do something sensible with the options we're passed
- $server->run($self->build_psgi_app($app, @args));
+ my $psgi = $self->build_psgi_app($app, @args);
+ $server->run($psgi);
}
=head2 build_psgi_app ($app, @args)
else {
$server = Plack::Loader->auto($self->_plack_loader_args);
}
- $app->run($server, $self->_application_args);
+ $app->run($self->_application_args, $server);
}
1;