Subject: | [PATCH] 'Program' as a scalar does not work |
POE::Wheel::Run::Win32 does not run the program when Program is given as
a scalar containing the full command line (including arguments) instead
of an array.
Also there are some bug when arguments are already given with quotes.
Patch attached.
Subject: | bug-Program-scalar-patch.txt |
--- lib\POE\Wheel\Run\Win32.pm.orig 2009-01-31 23:03:21.000000000 +0100
+++ lib\POE\Wheel\Run\Win32.pm 2009-03-10 10:29:04.859375000 +0100
@@ -3,7 +3,7 @@
use strict;
use vars qw($VERSION);
-$VERSION = '0.10';
+$VERSION = '0.11';
use Carp qw(carp croak);
use POSIX qw(
@@ -447,7 +447,7 @@
exit(0);
}
- # RUNNING_IN_HELL use Win32::Process to create a pucker new
+ # RUNNING_IN_HELL use Win32::Process to create a pucker new
# shiny process. It'll inherit our processes handles which is
# neat.
if ( POE::Kernel::RUNNING_IN_HELL ) {
@@ -464,18 +464,18 @@
}
my ($appname, $cmdline);
-
- if (ref($program) eq 'ARRAY') {
- $appname = $program->[0] =~ /\s/ ? qq{"$program->[0]"} : $program->[0];
- $cmdline = join(' ', map { /\s/ ? qq{"$_"} : $_ } (@$program, @$prog_args) );
+
+ if (ref $program eq 'ARRAY') {
+ $appname = $program->[0];
+ $cmdline = join(' ', map { /\s/ && ! /"/ ? qq{"$_"} : $_ } (@$program, @$prog_args) );
}
else {
- $appname = $program =~ /\s/ ? qq{"$program"} : $program;
- $cmdline = join(' ', map { /\s/ ? qq{"$_"} : $_ } ($program, @$prog_args) );
+ $appname = undef;
+ $cmdline = join(' ', $program, map { /\s/ && ! /"/ ? qq{"$_"} : $_ } @$prog_args);
}
my $w32job;
-
+
unless ( $w32job = Win32::Job->new() ) {
print $sem_pipe_write "go\n";
close $sem_pipe_write;
@@ -503,7 +503,7 @@
exit($exitcode);
}
-
+
if (ref($program) eq 'ARRAY') {
exec(@$program, @$prog_args)
or die "can't exec (@$program) in child pid $$: $!";
@@ -512,7 +512,7 @@
exec(join(" ", $program, @$prog_args))
or die "can't exec ($program) in child pid $$: $!";
}
-
+
die "insanity check passed";
}