Correctly pass argv option into Catalyst::Engine::HTTP
Tomas Doran [Sat, 9 Jan 2010 16:43:25 +0000 (16:43 +0000)]
Changes
lib/Catalyst/Engine/HTTP.pm
lib/Catalyst/Script/Server.pm
t/aggregate/unit_core_script_server.t

diff --git a/Changes b/Changes
index 82fc119..5ea6cc9 100644 (file)
--- a/Changes
+++ b/Changes
    - Fix regression in the case where mod_rewrite is being used to rewrite
      requests into a path below your application base introduced with the
      %2F related fixes in 5.80014_02.
+   - Do not crash on SIGHUP if Catalyst::Engine::HTTP->run is not passed the
+     argv key in the options hash.
+   - Correctly pass the arguments to Catalyst::Script::Server through to
+     Catalyst::Engine::HTTP->run so that the server can restart itself
+     with the correct options on SIGHUP.
 
   Cleanups:
     - Stop suppressing warnings from Class::C3::Adopt::NEXT now that most plugins
index 62c5d0b..7f01795 100644 (file)
@@ -339,7 +339,7 @@ sub run {
         use Config;
         $ENV{PERL5LIB} .= join $Config{path_sep}, @INC;
 
-        exec $^X, $0, @{ $options->{argv} };
+        exec $^X, $0, @{ $options->{argv} || [] };
     }
 
     exit;
index 4fc199b..e1f1049 100644 (file)
@@ -190,6 +190,7 @@ sub _application_args {
         $self->port,
         $self->host,
         {
+           argv => $self->ARGV,
            map { $_ => $self->$_ } qw/
                 fork
                 keepalive
index c75cec6..b9ad60b 100644 (file)
@@ -89,6 +89,8 @@ sub testOption {
     };
     # First element of RUN_ARGS will be the script name, which we don't care about
     shift @TestAppToTestScripts::RUN_ARGS;
+    # Mangle argv into the options..
+    $resultarray->[-1]->{argv} = $argstring;
     is_deeply \@TestAppToTestScripts::RUN_ARGS, $resultarray, "is_deeply comparison " . join(' ', @$argstring);
 }