>Hi everyone,
>I saw the following on another PERL list-serve:

>"If you are on windows, then see perlfaq8 if ActiveState perl for
>how to redirect STDOUT and STDERR when doing backticks."

>I'd like to be able to capture STDOUT as a string.  But nothing on 
perlfaq8 struck me as relevant.  Did I miss >something?  How do I do this? 
 I frequently get drastic errors (my computer shuts down!) when I try to 
use backticks. 

and I replied:
I do this in nearly all of my perl scripts - at least once.  Here'some 
code. 

my $status = `dir 2>&1`; 

Output (Stdout & Stderr) are both captured in the $status variable. 
Hope this helps, (and I hope that's what you were asking) 

And Chris answered:
>Hi Martin,
>Thanks.
>The output from what is captured?

The output from the "dir" command.

>  Let me elaborate on what I'm trying to do.  I'd like to test if certain 
scripts have syntax errors.  But if I do
>my $return = `perl -c $progname 2>&1`;
>the computer crashes.

Ahhh.....look at what you're trying to do here.  You're launching an 
instance of perl by running the
script which has the above code.  Then, in your code, you're launching 
another instance of perl.exe.

I suspect that this is what is crashing the machine...BUT...
I took your code and tested it and it ran fine.  Methinks there is
some other instability on your machine or in your code.  Maybe uninstall 
Perl and
re-install?  Maybe try to determine where exactly in the script it 
crashes?  Might
not be crashing on that command at all...

-mm

--
Martin A. Miller
Walgreens Integration Architecture Group (AKA StdCfg)
847-914-5138

You can't accuse me of anything I haven't 
already confessed to.
                                      -- Keith Richards
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to