in reply to capturing STDOUT after Win32::Process::Create()

open2 / open3 is something that can be done instead of CreateProcess.

If you're not feeding anything to it using STDIN, you can simply use:

open(COUNTER, "$COUNTERS_NAME -interval $interval |") or die("...: $!\n"); while (<COUNTER>) { ... }

Replies are listed 'Best First'.
Re^2: capturing STDOUT after Win32::Process::Create()
by bmc_mark (Novice) on Nov 30, 2004 at 15:26 UTC
    I was afraid of that...the problem is, I have to "Wait"
    after $COUNTERS_NAME executes for one minute. If I use your
    open command, I won't be able to execute another perl command
    while $COUNTERS_NAME executes...

    Can I set STDOUT to go to a file before calling
    Win32::Process::Create(), then set it back when done?
    Thanks so far, your comment cleared up a confusing
    post from a less prestigious source...
        I used plain old open(), as and came to realize that I
        shouldn't even need the wait...the process I kick off
        executes a step, waits one min. then does it
        again...the time between the 2nd execution step and the
        end of the process is negotiable, I can let it
        finish then run the command I thought I needed a
        "Wait()" for. I've just never played with open
        commands till now...they are a bit confusing at first
        glance.

        btw the chatterbox client is pretty cool, I got it to fire
        up, but I haven't connected yet to perlmonks...
      If I use your open command, I won't be able to execute another perl command while $COUNTERS_NAME executes...

      Not true, you can.

      I have to "Wait" after $COUNTERS_NAME executes for one minute.

      You can use sleep(60), or poll time, ...

      Can I set STDOUT to go to a file before calling Win32::Process::Create(), then set it back when done?

      I think you could execute cmd /c mycommand args > outputfile instead of just mycommand args