develooper Front page | perl.perl5.porters | Postings from August 2013

Re: Should runperl warn about "<"?

Thread Previous | Thread Next
Craig A. Berry
August 31, 2013 00:20
Re: Should runperl warn about "<"?
Message ID:
On Fri, Aug 30, 2013 at 5:14 PM, Zefram <> wrote:
> Father Chrysostomos wrote:
>>runperl warns about quotes not being portable.  It seems < is not
>>portable either.  See commit 8738904.  Should it warn about "<"?  What
>>about ">"?
> It should warn about both.  Shell redirection rules are no more portable
> than shell quoting rules.

The particular gotcha with 8738904 was that a left angle bracket as
the first character of an argument triggered the home-grown
command-line redirection code on VMS (which is done within Perl, not
by the CLI).  Since the quotes had already been removed by the CLI,
the '<' was taken as a redirection character very early during
start-up and way before anything resembling glob() was known about or
could be invoked.

Anything doing actual work with <> readline syntax wouldn't be affected.

This works:

$ perl -"Dt" -e "$x=<foo>;"


(-e:0) enter
(-e:0) nextstate
(-e:1) gvsv(main::x)
(-e:1) gv(main::foo)
(-e:1) readline
(-e:1) leave

This doesn't:

$ perl -"Dt" -e "<foo>;"
Can't open input file foo>; as stdin
%RMS-E-FNF, file not found

So if there is a warning to be added to runperl, it would be for a
redirection character as the first character of an argument (before
quotes are added).

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