Your skill will accomplish
what the force of many cannot
When -w and use strict aren't enough...by RMGir (Prior)
|on Nov 04, 2003 at 13:15 UTC||Need Help??|
RMGir has asked for the
wisdom of the Perl Monks concerning the following question:
(This might be more appropriate as a Meditation, or a Perl Gripe, if this site had such a section. But maybe someone has some Perl Wisdom to offer that could help me work around this issue...)
I ran into an annoying problem today, again.
Whenever I code, I always use strict, -w, and code defensively. I try to test as much as I can, and I always make sure at a minimum that code is -c clean after any editing pass.
But I still get bit, on occasion, by typos in function names.
The only way you'll find out that there's a typo in
is at run time, when the app croaks because "Undefined subrouting &main::handelNewYear called at...", and only if you happen to excercise that branch of your code.
If it happens to be your new year's day special case handling logic, I guess you'll get beeped out of the party :)
I realize there's no way -w could catch this; there could be autoloads providing the subroutine, or it could have been dynamically generated at runtime in an eval, or something.
But it would be nice if there was a way to catch such cases, without having to write a test suite that exercises every code branch, which isn't always (or even usually) possible.