Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2021-12-09 14:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    R or B?



    Results (36 votes). Check out past polls.

    Notices?