Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: capturing command output

by Ratazong (Monsignor)
on Jan 25, 2012 at 10:21 UTC ( #949866=note: print w/replies, xml ) Need Help??

in reply to capturing command output

Two aspects you might want to consider

  • writing to a temporary output file (as done in your example) might lead to troubles with write-access-rights
  • writing to a temporary output file is helpful when debugging, as that file can be checked easily afterwards outside of perl (unless you delete it)
In my projects, I have no real preference. I typically decide it case-base-case based on the "feeled risk of needing debugging info"

HTH, Rata

Update: Oooops! I have overlooked the pipe-symbol. So please ignore my answer above! Thanks for pointing this out, BrowserUk!

Replies are listed 'Best First'.
Re^2: capturing command output
by BrowserUk (Pope) on Jan 25, 2012 at 10:23 UTC

    The code is not writing to a temporary file. The external process is writing directly to a pipe which is then read in the while loop.

    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    The start of some sanity?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://949866]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2018-05-28 01:47 GMT
Find Nodes?
    Voting Booth?