Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^5: capturing command output

by JavaFan (Canon)
on Jan 26, 2012 at 15:07 UTC ( #950110=note: print w/ replies, xml ) Need Help??


in reply to Re^4: capturing command output
in thread capturing command output

That's why I normally code a wrapper around system calls.
Like this?
sub backticks { `$_[0]`; }


Comment on Re^5: capturing command output
Download Code
Replies are listed 'Best First'.
Re^6: capturing command output
by pklausner (Scribe) on Jan 26, 2012 at 16:21 UTC
    Almost. Although your backticks is a bit short on the logging and redirection part ;-)
      It's using the same logging as the OP did (that is, none). And I fail to see why backtick "$cmd 2>&1", using the same $cmd from the OP doesn't give you redirection.

        Although the original does no logging, I dared to propose that this might be useful for non-trivial calls. As might be a redirection duplication of stderr and/or stdout to some location where you can inspect it. Or show it depending on a verbosity option.
        And yes, all of this is unnecessary in perfect code.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (14)
As of 2015-07-31 20:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (282 votes), past polls