Do you know where your variables are? | |
PerlMonks |
Re: Critique requested for module code - QuickMemo+ readerby stevieb (Canon) |
on Jan 24, 2021 at 18:22 UTC ( [id://11127384]=note: print w/replies, xml ) | Need Help?? |
Remove things like this:
If the name of the subroutine does not accurately describe what the sub does, come up with a better name. Beyond that, you can put a description in the documentation. Don't clutter code with comments unless absolutely necessary. Speaking of documentation, where is it? How about unit tests? Why are you passing around a reference to a scalar for a string? Why not just work with the string? Scalar refs aren't that normal and can lead to easy to miss subtleties. Put new lines around return statements. You should easily be able to see where exit paths are in code: From:
To:
You're not checking the value of $note_created_time before using it in a string. It very well could be empty. I probably mentioned tests already, but it's worth repeating. Write tests. Learn about Devel::Cover. This is a very, very simple distribution so 100% coverage or at minimum extremely close to it should be trivial. Is this in a version control system?
In Section
Seekers of Perl Wisdom
|
|