New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overloaded readpipe function arguments aren't interpolated #12499
Comments
From jgibson@perforce.comCreated by jgibson@perforce.comWhen overloading readpipe, the arguments it is passed are the literal Note that one semi-workaround is to use package variables ('our' vs #! /usr/bin/env perl use feature ':5.16'; sub _readpipe { say "overload argument: '@_'" } BEGIN { *CORE::GLOBAL::readpipe = \&_readpipe } my $cmd = 'uname'; # Prints : overload argument: '$cmd' `$cmd`; __END__ Perl Info
|
From @jkeenanOn Wed Oct 17 17:13:08 2012, jgibson@perforce.com wrote:
I have never had occasion to use the readpipe function, so I don't claim
My hunch is that your problem has nothing to do with readpipe or with ##### Strictly speaking, nothing. Stylistically speaking, it's not a good way Writing backticks in your program sends a clear message to the readers In the example provided, you are using backticks in a void context. ##### I don't know whether the first `$cmd` *runs* uname or not. But it's In contrast, collecting the output of `$cmd` in a variable makes that The following collects and uses the output of the backticked command ##### So, unless others have different views, I don't think we have a bug here. Thank you very much. |
The RT System itself - Status changed from 'new' to 'open' |
From @cpansproutOn Wed Oct 17 18:53:34 2012, jkeenan wrote:
I couldn’t disagree more with that paragraph, but that is not relevant
But if you override readpipe, which makes `` call your readpipe
This interpolates: $ perl -MO=Deparse -e '$_ = `$cmd`' This does not: $ perl -MO=Deparse -e 'use subs "readpipe"; $_ = `$cmd`' -- Father Chrysostomos |
From @cpansproutOn Wed Oct 17 20:08:06 2012, sprout wrote:
It has been this way since it was added in this commit: commit e3f73d4 Make readpipe() overridable (and also `` and qx//) That is a very strange-looking commit. readpipe was already overridable + which just grabs the source code and stuffs it into an SV, which would -- Father Chrysostomos |
From @jkeenanOn Thu Oct 18 08:59:17 2012, sprout wrote:
Since we do have a bug -- and one I don't know how to fix it -- I'll de-own this RT. |
From jgibson@perforce.comOn Oct 17 18:53, James E Keenan via RT wrote:
Hi Jim and F.C., Thanks for taking a look at my report and confirming the finding. I just wanted to follow-up with Jim's style comment by saying that the For me, the point of using the backticks over qx is that it's a minimal |
From @cpansproutFixed by ea23863. -- Father Chrysostomos |
@cpansprout - Status changed from 'open' to 'resolved' |
From jgibson@perforce.com
Thank you! :D |
From @cpansproutOn Wed Nov 06 13:10:19 2013, jgibson@perforce.com wrote:
Sorry, that was the wrong commit ID. It was 6a5c965. -- Father Chrysostomos |
Migrated from rt.perl.org#115330 (status was 'resolved')
Searchable as RT115330$
The text was updated successfully, but these errors were encountered: