Fix readpipe overriden with a constant
qx and `` don’t take into account that some subs are stored in a more
lightweight form than usual. These two programs should behave the
same way, but, as you can see below the __END__ markers, the output is
different:
use constant foo=>1;
BEGIN { *{"CORE::GLOBAL::readpipe"} = \&{"foo"}; 1}
warn ``
__END__
Warning: something's wrong at - line 3.
use constant foo=>1; BEGIN { *{"CORE::GLOBAL::readpipe"} = \&{"foo"}; 1} warn ``
__END__
Too many arguments for CORE::GLOBAL::readpipe at - line 3, at end of line
Execution of -e aborted due to compilation errors.
The latter is the correct behaviour.¹ The only different is \&{"foo"}
vs \&foo, which triggers an optimisation.
S_readpipe_override in toke.c needs to take the optimisation into
account (that stash entries are not necessarily globs but can be
upgraded to such).
¹ Except that the sub name reported is unexpected. Non-threaded
builds give me that; threaded builds give me main::foo. But that is
a separate bug.