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:
Hashin P
Date:
July 29, 2008 06:26
Subject:
Re: Creative and *routine* use of so-called "magic" ARGV (was [perl #2783] Security of ARGV using 2-argument open)
Message ID:
5c4981ce0807290626u4e55d31cg1eef34f551af823f@mail.gmail.com
What do \Q and \E stand for?

On Tue, Jul 29, 2008 at 2:22 PM, Mark Mielke <mark@mark.mielke.cc> wrote:

> 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