We need to capture @ARGV in the restarter, for the benefit of Win32
Dave Rolsky [Fri, 29 May 2009 22:28:39 +0000 (22:28 +0000)]
only, so that it can re-execute itself with the right
options. Getopt::Long eats @ARGV before we have a chance to get to it.

Changes
lib/Catalyst/Devel.pm
lib/Catalyst/Helper.pm
lib/Catalyst/Restarter.pm
lib/Catalyst/Restarter/Win32.pm

diff --git a/Changes b/Changes
index 9001f97..b8d1394 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,11 @@
 This file documents the revision history for Perl extension Catalyst-Devel.
 
+1.18
+        - More fixes for the Win32 restarter. It was effectively
+          ignoring all command-line options except those related to
+          the restarter itself.
+
+
 1.17    2009-05-24 18:18:17
         - Catalyst::Restarter::Forking loaded the threads and
           Thread::Cancel modules, even though it doesn't need them.
index 75680f2..2d05f92 100644 (file)
@@ -4,7 +4,7 @@ use strict;
 use warnings;
 
 our $VERSION             = '1.17';
-our $CATALYST_SCRIPT_GEN = 38;
+our $CATALYST_SCRIPT_GEN = 39;
 
 $VERSION = eval $VERSION;
 
index c10b438..1798995 100644 (file)
@@ -1051,6 +1051,7 @@ if ( $restart ) {
     my $restarter = $subclass->new(
         %args,
         start_sub => $runner,
+        argv      => \@argv,
     );
 
     $restarter->run_and_watch;
index d95a944..7a7c6ff 100644 (file)
@@ -13,6 +13,12 @@ has start_sub => (
     required => 1,
 );
 
+has argv =>  (
+    is       => 'ro',
+    isa      => 'ArrayRef',
+    required => 1,
+);
+
 has _watcher => (
     is  => 'rw',
     isa => 'File::ChangeNotify::Watcher',
index ef39ee4..65a8e3e 100644 (file)
@@ -16,7 +16,7 @@ sub _fork_and_start {
 
     # This is totally hack-tastic, and is probably much slower, but it
     # does seem to work.
-    my @command = ( $^X, $0, grep { ! /^\-r/ } @ARGV );
+    my @command = ( $^X, $0, grep { ! /^\-r/ } @{ $self->argv } );
 
     my $child = Proc::Background->new(@command);