in reply to Re^2: IPC::Run not working with wperl
in thread IPC::Run not working with wperl
The problem could be that wperl doesn't have a console. You could try prefixing the command line with cmd.exe /c ..., or even start /wait /b ....
run ['cmd.exe', '/c', $program, $type], \$dot, ">", binary(), $out; # or run ['start', '/wait', '/b', $program, $type], \$dot, ">", binary(), $ +out;
I don't have GraphViz to test these.
Failing that, it would be relatively easy to replace the call to IPC::Run::run() with a call to piped open supplying the input ($dot) to the command via echo. Something along the lines of (untested):
sub _as_generic { my($self, $type, $dot, $output) = @_; my $program = $self->{LAYOUT}; my $buffer; if ( ref $output || UNIVERSAL::isa(\$output, 'GLOB') ) { # $output is a filehandle or a scalar reference or something. # have to take a reference to a bare filehandle or run will # complain my $out = ref $output ? $output : \$output; my $pid = open my $pipe, '-|', qq[ echo $dot | $program $type +] or die $!; binmode $pipe; print $out <$pipe>; return; } elsif (defined $output) { # if it's defined it must be a filename so we'll write to it. system qq[ echo $dot | $program $type > $output ] ; return; } else { # but otherwise we capture output in a scalar my $pid = open my $pipe, '-|', qq[ echo $dot | $program $type +] or die $!; binmode $pipe; return do{ local $/; <$pipe> }; } }
And that could be rationalised a bit.
|
|---|