X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FEngine.pm;h=16895f3ea9628c4c62ef2228e0b5a2a841e29b81;hp=407ceb5f9b8a37da23d0d43eafb0290ec86740d2;hb=1e5dad0099d51c919670c0e765615937b0fd4dae;hpb=697a3e9ee29085ff29867445df932df6de4cff9e diff --git a/lib/Catalyst/Engine.pm b/lib/Catalyst/Engine.pm index 407ceb5..16895f3 100644 --- a/lib/Catalyst/Engine.pm +++ b/lib/Catalyst/Engine.pm @@ -791,10 +791,11 @@ sub run { # FIXME - we should stash the options in an attribute so that custom args # like Gitalist's --git_dir are possible to get from the app without stupid tricks. - my $server = pop @args if blessed $args[-1]; - my $options = pop @args if ref($args[-1]) eq 'HASH'; + my $server = pop @args if (scalar @args && blessed $args[-1]); + my $options = pop @args if (scalar @args && ref($args[-1]) eq 'HASH'); if (! $server ) { - $server = Catalyst::Engine::Loader->auto(); # We're not being called from a script, + $server = Catalyst::Engine::Loader->new(application_name => ref($self))->auto(); + # We're not being called from a script, # so auto detect what backend to run on. # This should never happen, as mod_perl # never calls ->run, instead the $app->handle