develooper Front page | perl.perl5.porters | Postings from April 2010

Re: RFC: Perl manual pages -- update to follow the perlstyle.pod guidelines

Thread Previous | Thread Next
From:
Tom Christiansen
Date:
April 4, 2010 05:51
Subject:
Re: RFC: Perl manual pages -- update to follow the perlstyle.pod guidelines
Message ID:
22716.1270385432@chthon
> Similarly regarding || v.s. "or" you should expect newbies to do silly
> things like improve the style of their program by removing parens.

But it doesn't.

> Thus you should give them "or" because it's the least likely to break
> in that case:

>    open(my $fh, "<", $file) or die "Oh nohes"; # OK
>    open my $fh, "<", $file  or die "Oh nohes"; # Removed parens: OK
>    open(my $fh, "<", $file) || die "Oh nohes"; # OK
>    open my $fh, "<", $file  || die "Oh nohes"; # Removed parens: FAIL

I just don't believe removing parens from arguments above 
makes things clearer.  It's easier for me to read with them there.

> Actually these days we should just avoid the whole issue and
> recommend this:

>    use autodie;
>    open my $fh, "<", $file;

Perhaps.

--tom

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