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

Re^3: capturing command output

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


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

But besides handling stderr it gives you another layer of indirection.
So what? You have any idea how many layers of indirection there are on the open call? Or on the reading? Why is the number of layers of redirection an argument against backticks, but not about open, or the diamond operator?
Here it might actually be useful for logging the call (if it's generated) or storing the output for later inspection (it may not look as expected) or discard stderr or...
Sure, but he isn't doing any of that. One can critic any piece of code with "yeah, but if you want to do X in the future, it becomes harder". With arguments like that, you'd never write down a single line of code.

Replies are listed 'Best First'.
Re^4: capturing command output
by pklausner (Scribe) on Jan 26, 2012 at 15:01 UTC
    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...

      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 ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://949925]
help
Chatterbox?
[choroba]: and in fact, you don't push into the target repo, you push into your branch of your fork
[choroba]: the maintainer of the upstream repo than "merges" the pull request, i.e. they pull from your fork into the upstream
[Discipulus]: ' i.e. you asked them to pull from your repo' =~ I (subj) want to push
[Discipulus]: chorobayour words are reasonable
[choroba]: I'm just repeating some else's words as I remembered them after having asked the same question
[choroba]: s/some/someone/
Discipulus what a pity all people do not speak only in eatalian..
[choroba]: we'd need video calls more often :)
[Discipulus]: i still suspect english has some logical 'curvature/ crookedness' that has and will have a big impact over programming

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2017-05-27 20:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?