Hi,

Just to confirm that I'm not completely daft - and that I probably have too much time on my hands, example script below works as intended when packaged as

pp -o testipc.exe testipc.pl

Of course, it makes complete sense to use qx or IPC::Run3 if that fits requirement.

Regards

Mark

---------------------------------------------------

BEGIN {

    if($^O =~ /^mswin/i && defined($ENV{PAR_0}) && -f $ENV{PAR_0} ) {
        $^X = $ENV{PAR_PROGNAME};
        my $command = join(' ', @ARGV);
if($command =~ / -MIPC::Run::Win32Pump -e 1 \d+ \d+ \d+ \d+ \d+ \d+ \d+ /) {
            while( my $arg = shift( @ARGV )) {
                last if($arg eq '1');
            }
            eval{ require IPC::Run::Win32Pump; };
            die $@ if $@;
            exit(0);
        }
    }
}

use strict;
use warnings;
use IPC::Run qw( run );

my @cmd = ('help');

run \@cmd, '1>', \&RedirectOutput;

sub RedirectOutput
{
    my $output = shift;
    my @lines = split(/\n/, $output);
    print qq(IPCOUTPUT: $_\n) for (@lines);
    return;
}

1;


On 23/05/2011 14:30, Roderich Schupp wrote:
On Mon, May 23, 2011 at 2:49 PM, Mark Dootson<mark.doot...@znix.com>  wrote:
The following may be worth a try then, assuming pp passes all the arguments
and assigning to S^X doesn't break everything else. :-)

Err, no. pp doesn't enter the picture at run time. And when invoking
$ENV{PAR_PROGNAME}
you MUST pass "--par-options --reuse" followed by a real script (no -M, no -e).
I suggest to punt: use IPC::Run3 instead, the whole machinery of IPC::Run
isn't necessary in the original usecase.

Cheers, Roderich

Reply via email to