Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Code style question

by eyepopslikeamosquito (Archbishop)
on May 21, 2021 at 02:07 UTC ( [id://11132823]=note: print w/replies, xml ) Need Help??


in reply to Code style question

A quick scan of your module and I'm very impressed! Fantastic start for a Perl beginner! Just a couple of minor points I noticed after a quick scan of your code:

sub data_get(+$;$) {

Unless things have changed recently with the introduction of new Perl signatures, the traditional Perl code style advice has always been an emphatic "Don't use prototypes" -- see, for example, item 122 "Don't use subroutine prototypes" at Perl Best Practices. Googling just now turned up this this article by brian d foy on the newer experimental subroutine signatures (which I have no experience with).

This line of code from your module:

our $VERSION = '1.0.0';

is definitely wrong. It should read:

our $VERSION = '1.00';
This is one item that PBP unfortunately got wrong as mentioned here. See also Writing Solid CPAN Modules for general advice on writing CPAN modules.

Update: As noted by haukex here: our $VERSION = "1.23"; seems to be the most compatible with the various Perl tools that parse code to find information on modules.

I maintain a long list of general references on code standards and style advice at: Re: I need perl coding standards (Coding Standards References)

Replies are listed 'Best First'.
Re^2: Code style question
by AlexP (Pilgrim) on May 31, 2021 at 17:59 UTC

    You are great community and Perl is my best now! Thanks for tips and tricks and your time.

    It takes several weeks for me to examine all this information and in the end i refactored my module and create style guide here. Maybe it will be helpful for other neofits.

    PS. There is a big style node by eyepopslikeamosquito on PerlMonks. Could be useful if you are interested in this topic.

Re^2: Code style question
by AlexP (Pilgrim) on May 21, 2021 at 07:53 UTC

    WoW! You rocks, really helpful.

    It looks like my weekend promises to be interesting with lot's refactoring and studying perl.

    I'am neofit to perl, but have little experience in go and php.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11132823]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (5)
As of 2024-04-24 04:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found