Welcome to the Monastery | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Hello AlexP and welcome to the monastery and to the wonderful world of Perl!
Style is anyway a matter of taste. For what my opinion is worth I glanced your code and I'd say: @EXPORT and @EXPORT_OK are different: the latter makes no sense if you already export some function. Do you really need Exporter 5.74 and Scalar::Util 1.56 ? You must be as flexible as you can with users of your module: no need to ask them to upgrade to last version unless you know is the rigth thing to do. For example let say Scalar::Util included the blessed function from x.x version but you know your usage of it can trigger a bug up to x.y verion then and only then you ask the end user to have x.y version. Many authors use names with a leading underscore for private functions, even if they are not private. I prefere the and put at the end of the line and all and aligned: the same for or and for thernary like ? and : because somenting at the end of line is easier to spot. In your sub get_by_single_key you have if .. if .. if and this, style apart, sounds wrong: if .. elsif .. else sounds more appropriate. You set all return explicit and this is good and make the code more readable. Someone likes shorter statements like returns 1 if $x but this is a matter of taste. I dont like too much blank lines (again a matter of taste): for me, closing a brace } does not need a blank line after it.
L* PS you might be interested in my step-by-step-tutorial-on-perl-module-creation-with-tests-and-git even if i see you already implemented some test: good job!
There are no rules, there are no thumbs.. Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS. In reply to Re: Code style question -- code review
by Discipulus
|
|