develooper Front page | perl.perl5.porters | Postings from July 2011

Re: [PATCH] [DOCS] Modernize perlopentut.pod

Thread Previous | Thread Next
From:
Leon Timmermans
Date:
July 18, 2011 06:13
Subject:
Re: [PATCH] [DOCS] Modernize perlopentut.pod
Message ID:
CAHhgV8ivD5jSauHGRmW4StLShdj1Vftj+XOcXj_pNWravfsUqA@mail.gmail.com
On Sun, Jul 17, 2011 at 11:39 AM, Matt S Trout <mst@shadowcat.co.uk> wrote:
> Oh, and I'd be totally happy with two arg being introduced.
> But *later*. Because in my experience most newbies read just
> far enough to get *an* open to work, and then just keep on
> using the first one they saw.
>
> In fact, the only exploit of a piece of code I wrote that I
> know of was because *I* stopped reading too soon and ended
> up with an unsafe 2 arg open.
>
> We recommend everybody does 'use strict' by default because
> it helps protect us from ourselves. The same applies to 3
> arg open, especially in a tutorial document aimed at newbies
> who don't yet know enough to know when they're about to
> shoot themselves in the face.

I agree. I've seen 2-arg open cause enough bugs (like this one:
https://rt.cpan.org/Ticket/Display.html?id=64504), I'd rather explain
them to use 3-args by default than explain when 2-args is safe and
when it isn't.

Leon

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