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 | Thread Next
From:
Mark Mielke
Date:
July 29, 2008 06:22
Subject:
Re: Creative and *routine* use of so-called "magic" ARGV (was [perl#2783] Security of ARGV using 2-argument open)
Message ID:
488F19A3.8020003@mark.mielke.cc
David Nicol wrote:
> Whoever is compiling the module of handy preprocesses for ARGV may
> wish to consider
>
> BEGIN { @ARGV = map  "< \Q$_\E"  @ARGV }
>
> as in
>
> cat <<EOM > SafeMagicalFootball.pm
> package SafeMagicalFootball;
>
> sub import { @ARGV = map  "<\Q$_\E" @ARGV }
>
> 1;
> EOM
>   

It's a good thought that those who are very concerned about <> can use 
an ARGV preprocessor. Unfortunately, you're suggestion doesn't work. :-)

Specifically, \Q...\E will prefix certain characters with '\', and this 
will make it impossible to represent file names with the same special 
characters (the theoretical filenames with '|', '<' or '>') but that are 
not escaped in the file name.

Cheers,
mark

-- 
Mark Mielke <mark@mielke.cc>


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About