Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Hi monks!

I'm new to perl and already like this language. To learn it, I decided to write a module. However, there is not enough information on the code style.

There is an official https://perldoc.perl.org/perlstyle which is a bit superficial with a few examples. I also came across the following two sources: https://github.com/chusqui/perl-style-guide and https://github.com/htrgouvea/perl-style-guide, who partly contradict each other and even with official perlstyle. Finally i found https://metacpan.org/pod/Perl::Tidy and applied it to my code... Something really strange happened.

So could you please show me the way or good resources about code style?

Also here is my module source code https://github.com/AlexP007/perl-data-dot/blob/main/lib/Data/Dot.pm.

I'll be very thankful if you could tell me what can be done better and what's the best way to format code.

P.S. So what's the right indent: 2 or 4?


In reply to 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 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?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-25 14:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found