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:
Jari Aalto
Date:
April 3, 2010 11:19
Subject:
Re: RFC: Perl manual pages -- update to follow the perlstyle.pod guidelines
Message ID:
877hoo5ria.fsf@jondo.cante.net
"H.Merijn Brand" <h.m.brand@xs4all.nl> writes:

>> adhering to the style conventions.
>
> Conclusions from this threa[dt] so far:
>
> OK:
>
>   1. Add spaces after comma in argument lists:
>
>      open(FOO,$foo)      => open(FOO, $foo)
>
>   2. Make indentation consistent
>
>      I suggest using 2-space indent everywhere, as otherwise pod will
>      have render trouble with longer lines if you would use the wider
>      accepted 4-space indent.

From perldoc perlstyle.pod:

    4-column indent.

Running a quick test[1] through Debian Perl installation (*.pm) files
reveal following:

    Totals BY INDENTATION LEVEL (multiples of)
    ------------------------------------------
    2 20113
    3 20868
    4 98087             << majority of the code uses 4-column indentation
    5 2840

The numbers are not accurate by itself (I'm not positive I got all *.pm
included), but the values relative to each others can give a feel.

> NOT OK:
>
>   3. &&,|| => and, or
>
>      read the thread to note the pitfalls
>
>   4. remove parens
>
>      too much disagreeing

The current perlfunc.pod page uses:

    my $color  = substr $s, 4, 5;      # black
    my $middle = substr $s, 4, -11;    # black cat climbed the
    my $end    = substr $s, 14;        # climbed the green tree

This would suggest that in simple contexts, presenting the basic
function use could be done without prens.

Tom was inclined to concur, provided I understood correct, to use:

    if (length $var)        for (sort keys %hash)

instead of

    if (length($var))       for (sort(keys(%hash)))

About the "my" everywhere int the loops, I'd suggest adding it
everywhere, so that the "quick reader" always sees it:

    for my $var ...

Does these sound reasonable?
Jari

[1] http://github.com/jaalto/project--perl-indent-stat


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