then at some point one or more lines likesub chk_timer;
and at the end the actual sub definition:chktimer $_ for @timers;
As you can see I mistyped the declaration, or changed my mind way through. Whatever, perl -c told me everything was OK. Incidentally, I alwayssub chktimer { # ... }
However I couldn't spot that typo and what I got was a runtime error:use strict; use warnings;
instead. BTW: unfortunately in this case, the condition in which the actual line(s) in which the (alleged) function call is executed is very rare, so I had to wait quite a while until I could spot that error.Can't access `chktimer' field in class Proc::ProcessTable::Process at +./scriptname.pl line 75
Now, of course perl has no way to understand that chk_timer was a typo for chktimer, but I wonder if it could be sensible to have a warning about subs that have been declared but not defined.
I can foresee objections to such a proposal in terms of deliberate symbol table manipulations, but even then I'm not really sure what the best choice could be... this is just a meditation after all!
In reply to Warning for "unused sub declarations"? by blazar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |