Front page | perl.perl5.porters |
Postings from June 2022
Re: Pre-RFC: readpipe with list args
Thread Previous
|
Thread Next
From:
Ricardo Signes
Date:
June 3, 2022 20:06
Subject:
Re: Pre-RFC: readpipe with list args
Message ID:
5637b4ec-f079-456a-835a-a57e643d3372@www.fastmail.com
On Wed, Apr 6, 2022, at 16:03, Felipe Gasper wrote:
> Whereas Perl’s `system` and `exec` built-ins can accept a list of parameters to pass to the called program, `readpipe` only takes a single argument. Thus, if you want to pass parameters to the called program, you have to apply shell quoting, which is error-prone.
>
> This is confusing and strange, I think. It would seem ideal for `readpipe` to work as `system` and `exec` do.
=head2 readpipe(LIST)
system() accepts a LIST syntax (and a PROGRAM LIST syntax) to avoid
running a shell. readpipe() (the function behind qx//) could be similarly
extended.
This went into perltodo.pod in 2004, coming up on 18 years ago.
About 12 years later, Father Chrysostomos added a note about why this might not be as simple as "extend readpipe":
Note that changing readpipe() itself may not be the solution, as it currently has unary precedence, and allowing a list would change the precedence.
My two cents: All of perl's mechanisms for opening subprocesses and dealing with their I/O are annoying. open does too much. system is weird (returns true on failure). exec is weirder (that indirect object behavior?!). readpipe is just another one.
Normally, I am not a fan of "don't fix this one thing, because other things would still be bad." But here, we can't "just fix" readpipe, we'd need to add another thing, and it'd be weird, too. I suggest people use a library for this problem until we have a more comprehensive solution to suggest.
--
rjbs
Thread Previous
|
Thread Next