CARVIEW |
Select Language
HTTP/2 200
cache-control: max-age=43200
server: Combust/Plack (Perl)
vary: Accept-Encoding
content-encoding: gzip
content-length: 2531
content-type: text/html; charset=utf-8
last-modified: Sat, 11 Oct 2025 15:48:10 GMT
date: Sat, 11 Oct 2025 15:48:10 GMT
strict-transport-security: max-age=15768000
Re: Alarums and Excursions (was [perl #2783] Security of ARGVusing 2-argument open) - nntp.perl.org
Front page | perl.perl5.porters |
Postings from July 2008
nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About

Re: Alarums and Excursions (was [perl #2783] Security of ARGVusing 2-argument open)
Thread Previous | Thread NextFrom:
Aristotle PagaltzisDate:
July 28, 2008 01:06Subject:
Re: Alarums and Excursions (was [perl #2783] Security of ARGVusing 2-argument open)Message ID:
20080728080644.GS17817@klangraum.plasmasturm.org* Tom Christiansen <tchrist@perl.com> [2008-07-28 04:00]: > In-Reply-To: Message from Zefram <zefram@fysh.org> > of "Sat, 26 Jul 2008 23:18:19 BST." <20080726221819.GA15269@fysh.org> > > > I think these (<> and some of the regexp things) are > > unreasonably difficult to understand. > > While I see that you yourself have some difficulty, one > cannot--and should not--casually extrapolate one particular > user's conceptual troubles to an entire community or user-base. > > Perhaps it was not well-explained to you. I don't know. But I > firmly believe that programmers who'd rather write, or see > written, this sort of sequence: > > if (@ARGV == 0) { > @ARGV = ("-"); > } > > ARGUMENT: > while (@ARGV != 0) { > $ARGV = shift(@ARGV); > $ARGV = "<&=STDIN" if $ARGV eq "-"; > # that's an fdopen(3S); use <&STDIN (or <&0)for dup2(2) > unless (open(ARGV, $ARGV)) { > print STDERR "Can't open $ARGV: $!\n"; > next ARGUMENT; > } > > LINE: > while (defined($line = readline(*ARGV))) { > if ($line =~ /^=for\s+(index|later)/) { > next LINE; > } > $chars = $chars + length($line); > $words = $words + split(" ", $line, 0); > $lines = $lines + ($line =~ tr[\n][]); > } > } > > instead of just > > while (<>) { > next if /^=for\s+(index|later)/; > $chars += length; > $words += split; > $lines += y/\n//; > } > > or even better > > #!/usr/bin/perl -n > next if /^=for\s+(index|later)/; > $chars += length; > $words += split; > $lines += y/\n//; > > are few and far between. They do not understand Perl's > *spirit*, and probably never shall. That is a perfect demonstration of the problem. Currently, if I want 3-arg open semantics, I have no option but to write those exact reams of code, whereas if want 2-arg open semantics, I can just use the diamond and get that whole raft of features for free. In practice, that means I opt for the diamond despite it having what for my use cases is a misfeature. Having the two options be just a *little* less disproportionate would be worthwhile, don’t you agree? Regards, -- Aristotle Pagaltzis // <https://plasmasturm.org/>Thread Previous | Thread Next
- Alarums and Excursions (was [perl #2783] Security of ARGV using 2-argument open) by Tom Christiansen
- Re: Alarums and Excursions (was [perl #2783] Security of ARGVusing 2-argument open) by Aristotle Pagaltzis
- Re: Alarums and Excursions (was [perl #2783] Security of ARGV using 2-argument open) by Zefram
- RE: Alarums and Excursions (was [perl #2783] Security of ARGV using 2-argument open) by Ed Avis
- RE: Alarums and Excursions (was [perl #2783] Security of ARGVusing 2-argument open) by Mark Dominus
- Re: Alarums and Excursions (was [perl #2783] Security of ARGV using2-argument open) by Glenn Linderman
- Re: Alarums and Excursions (was [perl #2783] Security of ARGVusing 2-argument open) by Abigail
- Re: Alarums and Excursions (was [perl #2783] Security of ARGV using 2-argument open) by Tels
- Re: Alarums and Excursions (was [perl #2783] Security of ARGV using 2-argument open) by Rafael Garcia-Suarez
- Re: Alarums and Excursions (was [perl #2783] Security of ARGV using2-argument open) by Andy Dougherty
- Re: Alarums and Excursions (was [perl #2783] Security of ARGVusing 2-argument open) by Dave Mitchell
- Re: Alarums and Excursions (was [perl #2783] Security of ARGVusing 2-argument open) by Abigail
- Re: Alarums and Excursions (was [perl #2783] Security of ARGV using2-argument open) by H.Merijn Brand
- RE: Alarums and Excursions (was [perl #2783] Security of ARGVusing 2-argument open) by Ed Avis
nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About