develooper Front page | perl.perl5.porters | Postings from July 2008

Re: Creative and *routine* use of so-called "magic" ARGV (was [perl#2783] Security of ARGV using 2-argument open)

Thread Previous
Roland Giersig
July 30, 2008 13:23
Re: Creative and *routine* use of so-called "magic" ARGV (was [perl#2783] Security of ARGV using 2-argument open)
Message ID:
Ed Avis wrote:
> Either have a warning or change the semantics; I don't think you need both. 
> Once people see the warning they will change their code to either explicit magic
> or explicit boring-file-opening.  Anyway, we can't plan as far ahead as 5.14.

Why not? To me it seems like a standard deprecation workflow, only that 
we immediately replace the function with something else...

> Pragmas are useful when you want to change the global behaviour of a program. 
> But typically <> is used in just one place, the main loop, and certainly in just
> one source file (by an unfortunate accident of perl's implementation, you cannot
> in general pass the ARGV filehandle to subroutines expecting a filehandle).

[Actually I thought about a pragma that switches behaviour only in this 
one version, but that would need to be called like 'eval { require 
safe_diamond }', which is ugly.]

> So I think a pragma is overkill here, better a way to explicitly say what you
> want: <SAFE_ARGV> or <MAGIC_ARGV>, with appropriate syntactic sugar to provide a
> <<>> operator or whatever.

Yes, that's also OK.

>> * "use v5.x" (for x < 12) of course should switch magical behaviour back 
>> on for '<>'.
> I think this is also getting a bit hairy and tangled.
 > ...
> Let's not put extra bizarre stuff into 'use 5.xx', it is awkward enough already.

Umm, I thought that this was one of the reasons to use 'use v5.x': not 
to be bug-compatible, but to be feature-compatible between mayor versions.

But OK, this was just an idea and isn't necessary for the procedure to work.


Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About