Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Capturing stats from sox

by jamesjyu (Acolyte)
on Jul 28, 2004 at 20:34 UTC ( #378204=perlquestion: print w/replies, xml ) Need Help??

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

I am trying to use backticks to capture the output from sox:
$out = `sox bla.wav -e stat`; print $out;
however, nothing gets assigned to $out. Is there something different about how sox returns stat info? I see the output printed to the screen, even when using backticks...

Replies are listed 'Best First'.
Re: Capturing stats from sox
by diotalevi (Canon) on Jul 28, 2004 at 20:39 UTC

    Oh! Here I thought you were asking about Sarbanes/Oxley, the happening thing in business these days.

    The output is probably going to STDERR instead of STDOUT which is captured. Try these two ideas.

    # Redirect output from STDERR to STDOUT $out = `sox ... 2>&1`
    { # Temporarily alias STDERR to STDOUT. local *STDERR = *STDOUT; $out = `sox blah.wav -e stat`; } print $out;
      Oh! Here I thought you were asking about Sarbanes/Oxley, the happening thing in business these days.

      This is horribly unrelated, but I was ready to talk about using LWP to download baseball statistics.

      great! thanks!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://378204]
Approved by integral
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2019-11-19 10:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (95 votes). Check out past polls.

    Notices?