On 24 July 2014 22:20, Eric Brine <ikegami@adaelis.com> wrote: > The goal is to change the behaviour of reading from ARGV, not <>. Same thing. <> is exactly equivalent to <ARGV>. Actually the lexer transforms <> into <ARGV> even before it gets to the parser. > Unless <<>> is short for <NOTARGV>, this seems like a broken design. What > happens if someone uses readline(), read() or sysread() on ARGV? Easy, readline is the same as <>, read and sysread bypass magic entirely. Nothing new here. > If <<>> is short for <NOTARGV>, then I think it's a messy solution. Does > that mean we also have $NOTARGV? I don't get your point. But note that the open magic is in <>/readline, not in ARGV. (My patch changes readline, not PL_argvgv.) > A global pragma sounds much better. > > > > On Thu, Jul 24, 2014 at 11:51 AM, Rafael Garcia-Suarez <rgs@consttype.org> > wrote: >> >> I believe that this was discussed here some years ago, and that this >> was suggested by TomC. Anyway, I pushed a patch on rgs/nomagicopen. >> The patch is incomplete as it lacks docs and tests. I welcome feedback >> on the intent of the feature. >> >> commit 7f5bb3418c4fc2d6e2523bf918a7d9e33f9a7acc >> Author: Rafael Garcia-Suarez <rgs@consttype.org> >> Date: Thu Jul 24 17:43:29 2014 +0200 >> >> Introduce the double-diamond operator <<>> >> >> This operator works like <> or <ARGV>, as it reads the list of file >> names to open from the command-line arguments. However, it disables >> the magic-open feature (that forks to execute piped commands) : >> >> $ bleadperl -e 'while(<>){print}' 'echo foo |' >> foo >> $ bleadperl -e 'while(<<>>){print}' 'echo foo |' >> Can't open echo foo |: No such file or directory at -e line 1. > >Thread Previous | Thread Next