in reply to Executing perl program from another perl program and capturing the output
Hi there,
You don't want to use 8.3 names. You just need to pass each individual parameter to system as a list, instead of together in a string. That way the parameters are already divided up and not further split on space characters. Unfortunately system does not capture its output, but Capture::Tiny is to the rescue in that regard:
use Capture::Tiny ':all'; my @cmd = ( 'C:\program files\myprog\space invaders.exe', 'parameter 1', 'parameter 2 with spaces' ); my ($stdout, $stderr, $exit) = capture { system @cmd }; print "The return status was $exit\n"; print "The output was $stdout\n";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Executing perl program from another perl program and capturing the output
by Anonymous Monk on Nov 25, 2014 at 03:14 UTC | |
by Loops (Curate) on Nov 25, 2014 at 03:18 UTC | |
by Anonymous Monk on Nov 25, 2014 at 03:31 UTC |
In Section
Seekers of Perl Wisdom