develooper Front page | perl.perl5.porters | Postings from October 2014

Re: [perl #122938] [PATCH] 1. Remove trailing space in perlipc.pod .2. Modernise one of the examples

Thread Previous | Thread Next
From:
Aristotle Pagaltzis
Date:
October 15, 2014 03:03
Subject:
Re: [perl #122938] [PATCH] 1. Remove trailing space in perlipc.pod .2. Modernise one of the examples
Message ID:
20141015030343.GA12260@plasmasturm.org
* James E Keenan via RT <perlbug-followup@perl.org> [2014-10-11 03:50]:
> On Fri Oct 10 00:25:37 2014, shlomif@shlomifish.org wrote:
> > * https://github.com/shlomif/perl/tree/shlomif-perlipc-changes
>
> While I personally like the revisions you present in your second
> patch, I know that our contributors have a range of opinions such
> changes. So I'm going to request additional eyeballs before applying.

I have some quibbles with all of the individual edits, but there is only
one I really disagree with.

> -  #!/usr/bin/perl -w
> +  #!/usr/bin/perl
> +
> +  use strict;
> +  use warnings;

Yes. And I rather like that there was already a shebang with -w so that
we can skip the “it’s distracting to add `use strict; use warnings;` to
every example” convo this time.

> -  $| = 1;
> +  STDOUT->autoflush(1);

This is always debatable to me in a small program… as it automagically
loads a fairly heavy module under the covers just so one can spell one
single assignment to one of the most commonly seen punctuation variables
with a rather verbose name. For this case I call “they’ll need to know
what $| is in their Perl programming life anyway” and oppose the edit.

> -  use File::Spec::Functions;
> +  use File::Spec::Functions (qw(catfile));

Yes, good. But why the extra parens?

> -      while (++$count) {
> +      while (1) {
> +          ++$count;
>            sleep 2;
>            print "$count\n";
>        }

Definitely. Though I would propose cutting the line count back down by
doing this instead:

-      while (++$count) {
+      while (1) {
           sleep 2;
-          print "$count\n";
+          print ++$count, "\n";
       }

(Just goes to show, you really needn’t obfuscate in order to be concise.
In fact this is both more obvious *and* more concise.)

-- 

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