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:
David Nicol
Date:
July 29, 2008 08:01
Subject:
Re: Creative and *routine* use of so-called "magic" ARGV (was [perl #2783] Security of ARGV using 2-argument open)
Message ID:
934f64a20807290801x4a2784a1yd4f3a649e32f73a6@mail.gmail.com
On Tue, Jul 29, 2008 at 9:32 AM, Abigail <abigail@abigail.be> wrote:

>
> It has been documented for a long, long time how to [handle leading/trailing space in 2-arg open]:
>
>    my $file = " hello ";
>    open my $fh, "< ./$file\0";
>
>
> Granted, "\0" is a bit of an oddity, but it is possibly. And you don't
> need sysopen.

so would

    $_ = (m|^/| ? "< $_\0" : "< ./$_\0") for @ARGV;

work as a football safety device, inserted into the execution process
at the appropriate time (i.e. after getopts)?

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