Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to run a command oggenc.exe and retrieve the output status (in this case percentage complete) but am having trouble doing so. I can't work out how to do it. off course I can run system("oggenc $file"); but I want to be able to extract the percent complete so I can print $status as a percent or something. any help/ideas much appreciated.

Corrected spelling in title 2002-01-12 dvergin

Replies are listed 'Best First'.
Re: runn command & get outut
by VSarkiss (Monsignor) on Jan 12, 2002 at 21:13 UTC
Re: runn command & get outut
by archen (Pilgrim) on Jan 12, 2002 at 22:43 UTC
    okay, to clarify this question (since a lot of people seem to be taking this the wrong way). oggenc ecodes files from wave files to ogg/vorbis format. As it does so it prints a basic status update (a spinner and the percent of the file done). My understanding is that he wants the status in REAL time somehow. system doesn't give anything back, and the backtic operator only gives output on the final status of what the program output (if memory serves me correctly - I've never tried to capture output of such a program).

    Now I don't know how this myself, but maybe my explanation will make things a tad bit more clear(?). Truth be told this might be going about this the wrong way entirely. You can for instance obtain an ogg/vorbis encoding .dll, and interface directly with the .dll instead of trying to capture the status of the command line. But as I said, I don't know how to approach your problem either.
      thanks for clarifying things for me. i am going to try & find out how to interface to a DLL.

        The easiest way, BTW, is probably using Inline::C or Inline::CPP. (Not that I have huge amounts of experince in the matter.

        Thanks,
        James Mastros,
        Just Another Perl Scribe

Re: runn command & get outut
by talexb (Chancellor) on Jan 12, 2002 at 21:09 UTC
    You need to provide more information before we have any hope of being able to help you. How does oggenc announce its progress? Is there a result file that grows to a particular size? Does it always take 45 seconds?

    More effort, please.

    --t. alex

    "Excellent. Release the hounds." -- Monty Burns.

      the progress of oggenc.exe is output to the msdos screen as "encoding... 2%" and increases accordingly. the time it takes is not the same each time as this depends on file size cpu etc.
Re: runn command & get outut
by Anonymous Monk on Jan 12, 2002 at 22:03 UTC
    I have been reading all the nodes re: getting output and am more confused now. All I want to do is store the output while the command is running so I can have a running progress stored in a variable. I will then use this to create a perl/tk progress bar rather than have a dos window. the program oggenc.exe. oggenc produces its output status to STDERR while it's running. I will also need to minimise the dos box or get rid of it somehow. maybe it isn't possible what I'm trying to do but I will continue resarching.