Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^4: capturing command output

by pklausner (Scribe)
on Jan 26, 2012 at 15:01 UTC ( #950107=note: print w/ replies, xml ) Need Help??


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

Why is the number of layers of redirection an argument against backticks

Sorry, must be a misunderstanding. Of course backticks operator and open call are equivalent. I meant to say that the extra subroutine adds a layer. And unless the external command is trivial or absolutely, totally predictable, this comes in handy to instrument it. At least that is my experience. That's why I normally code a wrapper around system calls. More than one way etc...


Comment on Re^4: capturing command output
Replies are listed 'Best First'.
Re^5: capturing command output
by JavaFan (Canon) on Jan 26, 2012 at 15:07 UTC
    That's why I normally code a wrapper around system calls.
    Like this?
    sub backticks { `$_[0]`; }
      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.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (19)
As of 2015-07-30 16:00 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 (273 votes), past polls