Re: Running perl from a test on Windows

[email protected] (David Cantrell)
Newsgroups perl.qa
Message-ID <[email protected]>
On Tue, Jan 15, 2013 at 01:32:09AM -0800, Buddy Burden wrote:
> Gabor,
> > I am not sure if this helps but in Windows you need to put the
> > double-quotes around  $cmd
> >
> >     my $output = qx{$^X -e "$cmd"};
> Yes, that would work if I were running _only_ on Windows.  But I need
> it work for everything (and the double quotes on Linux will cause any
> variables in my perl code to get intepreted by the shell. :-/

Use the multi-argument form of system() to avoid all shell nastiness,
and use Capture::Tiny to catch its output.

-- 
David Cantrell | London Perl Mongers Deputy Chief Heretic

  All principles of gravity are negated by fear
                                            -- Cartoon Law V
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.