As a general thing there is no "Right" code style, although there are plenty of wrong styles. Mostly, if you have thought about your style at all and are consistent the results will be pretty good. Looking at your module code it seems likely you have thought about style and are consistent and the results are pretty good.

With that in mind, there is no "Right" indent size. Like several others I mostly settle on 3 spaces (always spaces - never tabs) to indent all my code, except Perl! Because I contribute a reasonable amount of code to PerlMonks my Perl style tends to conform more to Perl norms which include 4 space indents and K&R layout. Like I said, there are no rights and consistency is King (at least within a language).

I also frequently use Perl::Tidy to clean things up after a heavy refactoring session (for example). It is a great tool and can be configured to generate pretty much whatever your preferred coding style is. It can take a while to beat its configuration into the right shape, depending on how far your style is from Perl::Tidy's defaults. But it's worth the effort of doing so that you can be comfortable to bash out some code then quickly tidy it up with Perl::Tidy.

Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond

In reply to Re: Code style question by GrandFather
in thread Code style question by AlexP

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.