- Unused code: By this, do you mean subroutines that never get called? Blocks such as if (0) {}?
- Unused variables: the -w switch does this one for you.
- Redundancy: I'm not sure how hard it would be to locate code redundancy, but I'm fairly sure it be an extremely tough one to accomplish. I'm not saying it's a bad idea, it would be amazing for code optimization, but I'm quite skeptical as to how one would go about this.
- Not checking return values: yes, this one could be done, but only to a *very* limitted extent! Not all return values need to "be checked" and have a die() if it's not successful. More often than not, subroutines return a value to be passed to a scalar or onto another subroutine, so it's an actual data value being returned, not a 'success or fail' one.
Who knows, maybe it would be easier to code than I think (except for that redundancy one, that's just impossible!). I think many people dream about perfect code that never needs to be improved.
Are there any tools for checking perl code beyond what the compiler checks?
Haven't you ever heard of perlmonks? Post your code on that site and see if anyone will give a helping hand in suggesting ways in which you could improve your code. Not many people will rewrite it for you, but many more will offer their wisdom. :)
Update (I seem to like these): A couple of people have wanted to see a new section created on the site for 'pay to get code and answers'. If anything, let's create a 'Improve This' section where users can post their code and ask for direction on how to improve the way in which things are handled. It could be said that these could be posted to SoPW, but I'm sure several people would become frustrated if SoPW were to be suddenly filled with requests of 'make my code better for me!'. I'm sure that if it weren't always the same few people offering up advice on coding things 'better' and everybody tried (whether successfully or not) to help out. I seem to think that everyone would be happy to have better code :)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.