Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://949866]
help
Chatterbox?
[Discipulus]: i need some converter to have directly an OVF format directly: at the moment i'm trying with vmware converter standalone
[Lady_Aleena]: I don't know what to tell you. I can barely get my Linux machine to do things I want.
[Discipulus]: if DE or WM means desktop env and win manager.. no, not an option
[Lady_Aleena]: That's what they mean, at least to me. 8)
[Discipulus]: in the first attempt i failed, with an not usable v-machine.. ;=)
[Discipulus]: but then discovered a registry trick to do before the physical2virtual migration
[Lady_Aleena]: Sounds like a headache.
[Discipulus]: a bit shaggy.. every atttempt is ~4hours to virtualize and 1-2hours to kick the big file to boot..

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2017-05-22 18:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?