On Mon, Jan 14, 2013 at 9:59 PM, Buddy Burden <barefootco...@gmail.com> wrote:
> Guys,
>
> Okay, my Google-fu is failing me, so hopefully one of you guys can help me 
> out.
>
> For a test, I need to run a snippet of Perl and collect the output.
> However, if it rus in the current interpreter, it will load a module
> that I need not to be loaded ('cause I'm also going to test if my code
> properly loads it).  So I want to run it in a separate instance of
> Perl.
>
> First (naive) attempt:
>
>     my $output = `$^X -e '$cmd'`;
>
> This works fine on Linux, but fails on Windows.  Happily, as soon as I
> saw the failures, I recognized I had a quoting problem.  No worries, I
> said: let's just bypass the shell altogether:

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"};

and of course inside $cmd you should use single quotes and not double
quotes if you need
some quotation.

Oh the joy :)

Gabor

Reply via email to